コード例 #1
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def updateNote(self, username, note_resource):
        if not 'note_text' in note_resource:
            raise BricklinkInvalidParameterException(
                'Invalid note resource. Should at least contain note_text')

        return self.client.put(self.URL_NOTE_UPDATE.format(username=username),
                               note_resource)
コード例 #2
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def updateOrderStatus(self, order_id, status):
        ORDER_STATUSES = (
            'PENDING',
            'UPDATED',
            'PROCESSING',
            'READY',
            'PAID',
            'PACKED',
            'SHIPPED',
            'RECEIVED',
            'COMPLETED',
            'OCR',
            'NPB',
            'NPX',
            'NRS',
            'NSS',
            'CANCELLED',
        )

        if not status in ORDER_STATUSES:
            raise BricklinkInvalidParameterException(
                'Invalid status. Should be one of {0}'.format(
                    str(ORDER_STATUSES)), status)

        params = {'field': 'status', 'value': status}

        return self.client.put(
            self.URL_ORDER_UPDATE_STATUS.format(order_id=order_id), params)
コード例 #3
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def getPriceGuide(self,
                      item_type='PART',
                      item_no='',
                      color_id=None,
                      guide_type=None,
                      new_or_used=None,
                      vat=False):
        ITEM_TYPES = ('MINIFIG', 'PART', 'SET', 'BOOK', 'GEAR', 'CATALOG',
                      'INSTRUCTION', 'UNSORTED_LOT', 'ORIGINAL_BOX')

        if not item_type in ITEM_TYPES:
            raise BricklinkInvalidParameterException(
                'Invalid item type. Should be one of {0}'.format(
                    str(ITEM_TYPES)), item_type)

        params = {
            'guide_type': guide_type,
            'new_or_used': new_or_used,
            'vat': 'Y' if vat else 'N'
        }

        if color_id is not None:
            params['color_id'] = color_id

        return self.client.get(
            self.URL_CATALOG_PRICE_GUIDE.format(type=item_type, no=item_no),
            params)
コード例 #4
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def getSubsets(self,
                   item_type='PART',
                   item_no='',
                   color_id=None,
                   box=None,
                   instruction=None,
                   break_minifigs=None,
                   break_subsets=None):
        ITEM_TYPES = ('MINIFIG', 'PART', 'SET', 'BOOK', 'GEAR', 'CATALOG',
                      'INSTRUCTION', 'UNSORTED_LOT', 'ORIGINAL_BOX')

        if not item_type in ITEM_TYPES:
            raise BricklinkInvalidParameterException(
                'Invalid item type. Should be one of {0}'.format(
                    str(ITEM_TYPES)), item_type)

        params = {
            # 'color_id': color_id,
            # 'box': box,
            # 'instruction': instruction,
            # 'break_minifigs': break_minifigs,
            # 'break_subsets': break_subsets
        }

        return self.client.get(
            self.URL_CATALOG_SUBSETS.format(type=item_type, no=item_no),
            params)
コード例 #5
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def createFeedback(self, order_id, rating, comment):
        if rating < 0 or rating > 2:
            raise BricklinkInvalidParameterException(
                'Invalid rating. Should be between 0 and 2.')

        params = {'order_id': order_id, 'rating': rating, 'comment': comment}

        return self.client.post(self.URL_FEEDBACK_CREATE, params)
コード例 #6
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def getKnownColors(self, item_type='PART', item_no=''):
        ITEM_TYPES = ('MINIFIG', 'PART', 'SET', 'BOOK', 'GEAR', 'CATALOG',
                      'INSTRUCTION', 'UNSORTED_LOT', 'ORIGINAL_BOX')

        if not item_type in ITEM_TYPES:
            raise BricklinkInvalidParameterException(
                'Invalid item type. Should be one of {0}'.format(
                    str(ITEM_TYPES)), item_type)

        return self.client.get(
            self.URL_CATALOG_COLORS.format(type=item_type, no=item_no))
コード例 #7
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def getSupersets(self, item_type='PART', item_no='', color_id=None):
        ITEM_TYPES = ('MINIFIG', 'PART', 'SET', 'BOOK', 'GEAR', 'CATALOG',
                      'INSTRUCTION', 'UNSORTED_LOT', 'ORIGINAL_BOX')

        if not item_type in ITEM_TYPES:
            raise BricklinkInvalidParameterException(
                'Invalid item type. Should be one of {0}'.format(
                    str(ITEM_TYPES)), item_type)

        params = {'color_id': color_id}

        return self.client.get(
            self.URL_CATALOG_SUPERSETS.format(type=item_type, no=item_no),
            params)
コード例 #8
0
ファイル: methods.py プロジェクト: remibergsma/py-bricklink
    def updateOrderPaymentStatus(self, order_id, status):
        ORDER_PAYMENT_STATUSES = (
            'None',
            'Sent',
            'Received',
            'Clearing',
            'Returned',
            'Bounced',
            'Completed',
        )

        if not status in ORDER_PAYMENT_STATUSES:
            raise BricklinkInvalidParameterException(
                'Invalid status. Should be one of {0}'.format(
                    str(ORDER_PAYMENT_STATUSES)), status)

        params = {'field': 'payment_status', 'value': status}

        return self.client.put(
            self.URL_ORDER_UPDATE_PAYMENT_STATUS.format(order_id=order_id),
            params)