Ejemplo n.º 1
0
def basic_auth(key, required_scopes=None):
    user_email = dboperations().get_email_by_sha(key)
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())
        if (body.email == user_email):
            return {'sub': 'operation'}
    return None
def place_order(body=None,
                id=None,
                pet_id=None,
                quantity=None,
                ship_date=None,
                status=None,
                complete=None):  # noqa: E501
    """Place an order for a pet

    Place a new order in the store # noqa: E501

    :param body: 
    :type body: dict | bytes
    :param id: 
    :type id: int
    :param pet_id: 
    :type pet_id: int
    :param quantity: 
    :type quantity: int
    :param ship_date: 
    :type ship_date: str
    :param status: 
    :type status: str
    :param complete: 
    :type complete: bool

    :rtype: Order
    """
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
    ship_date = util.deserialize_datetime(ship_date)
    return 'do some magic!'
Ejemplo n.º 3
0
    def test_place_order(self):
        """Test case for place_order

        Place an order for a pet
        """
        body = Order()
        response = self.client.open('/v2/store/order',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='*/*')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
def place_order(body):
    """
    Place an order for a pet
    
    :param body: order placed for purchasing the pet
    :type body: dict | bytes

    :rtype: Order
    """
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())
    return 'do some magic!'
Ejemplo n.º 5
0
    def test_place_order(self):
        """Test case for place_order

        Place an order for a word
        """
        body = Order()
        response = self.client.open('/sgrade/words/1.0.0/store/order',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
Ejemplo n.º 6
0
    def test_post_order(self):
        """Test case for post_order

        crea un nuevo pedido
        """
        body = Order()
        response = self.client.open('/omogollo2/ServerAPI/1.0.0/order',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
    def test_api_order(self):
        """Test case for api_order

        make an order
        """
        body = Order()
        response = self.client.open('/order',
                                    method='POST',
                                    data=json.dumps(body),
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))
Ejemplo n.º 8
0
def place_order(body):  # noqa: E501
    """Place an order for a word

     # noqa: E501

    :param body: order placed for purchasing the word
    :type body: dict | bytes

    :rtype: Order
    """
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
Ejemplo n.º 9
0
def api_order(body):  # noqa: E501
    """make an order

     # noqa: E501

    :param body: Created user object
    :type body: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
Ejemplo n.º 10
0
def place_order(body):  # noqa: E501
    """Place an order for a pet

     # noqa: E501

    :param body: order placed for purchasing the pet
    :type body: dict | bytes

    :rtype: Order
    """
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
Ejemplo n.º 11
0
def get_order(order_id):  # noqa: E501
    """Devuelve los datos un pedido

     # noqa: E501

    :param order_id: id del pedido a consultar
    :type order_id: int

    :rtype: Order
    """

    collection = db.order
    order = collection.find_one({'id': order_id})

    return Order(order['id'], order['orderDate'], order['shipDate'],
                 order['items'], order['shipAddress'], order['client'])
def withdraw(body):  # noqa: E501
    """Remove funds from account

     # noqa: E501

    :param body: Order object
    :type body: dict | bytes

    :rtype: None
    """
    withdraw=''
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
        withdraw=dboperations().withdraw(body.email,str(body.value))
    return { 
        "ststus":withdraw
        }
def deposit(body):  # noqa: E501
    """Add funds to account

     # noqa: E501

    :param body: Order object
    :type body: dict | bytes

    :rtype: None
    """
    deposit=''
    if connexion.request.is_json:
        body = Order.from_dict(connexion.request.get_json())  # noqa: E501
        deposit = dboperations().deposit(body.email,str(body.value))
    return { 
        "status":deposit
        }
Ejemplo n.º 14
0
    def test_place_order(self):
        """Test case for place_order

        Place an order for a pet
        """
        body = Order()
        data = dict(id=789,
                    pet_id=789,
                    quantity=56,
                    ship_date='2013-10-20T19:20:30+01:00',
                    status='status_example',
                    complete=true)
        response = self.client.open('/store/order',
                                    method='POST',
                                    data=json.dumps(body),
                                    data=data,
                                    content_type='application/json')
        self.assert200(response,
                       'Response body is : ' + response.data.decode('utf-8'))