Class: TophatterMerchant::Order

Inherits:
Resource
  • Object
show all
Defined in:
lib/tophatter_merchant/order.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Resource

#initialize, #to_hash

Constructor Details

This class inherits a constructor from TophatterMerchant::Resource

Instance Attribute Details

#address1Object



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def address1
  @address1
end

#address2Object



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def address2
  @address2
end

#annotationObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def annotation
  @annotation
end

#available_refundsObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def available_refunds
  @available_refunds
end

#carrierObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def carrier
  @carrier
end

#cityObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def city
  @city
end

#countryObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def country
  @country
end

#created_atObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def created_at
  @created_at
end

#customer_idObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def customer_id
  @customer_id
end

#customer_nameObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def customer_name
  @customer_name
end

#disbursement_amountObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def disbursement_amount
  @disbursement_amount
end

#order_idObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def order_id
  @order_id
end


4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def paid_at
  @paid_at
end

#postal_codeObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def postal_code
  @postal_code
end

#product_identifierObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def product_identifier
  @product_identifier
end

#product_nameObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def product_name
  @product_name
end

#refund_amountObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def refund_amount
  @refund_amount
end

#seller_feesObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def seller_fees
  @seller_fees
end

#seller_fees_amountObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def seller_fees_amount
  @seller_fees_amount
end

#stateObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def state
  @state
end

#statusObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def status
  @status
end

#tracking_numberObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def tracking_number
  @tracking_number
end

#variation_identifierObject



4
5
6
# File 'lib/tophatter_merchant/order.rb', line 4

def variation_identifier
  @variation_identifier
end

Class Method Details

.acknowledge(id) ⇒ Object

merchant-api.tophatter.com/docs/order-acknowledge TophatterMerchant::Order.acknowledge(60150685).status



45
46
47
# File 'lib/tophatter_merchant/order.rb', line 45

def acknowledge(id)
  Order.new get(url: "#{path}/acknowledge.json", params: { order_id: id })
end

.all(filter: nil, page: 1, per_page: 50) ⇒ Object

merchant-api.tophatter.com/docs/order-list TophatterMerchant::Order.all(filter: ‘unfulfilled’)



31
32
33
34
35
# File 'lib/tophatter_merchant/order.rb', line 31

def all(filter: nil, page: 1, per_page: 50)
  get(url: "#{path}.json", params: { filter: filter, page: page, per_page: per_page }).map do |hash|
    Order.new(hash)
  end
end

.annotate(id, annotation) ⇒ Object

merchant-api.tophatter.com/docs/order-annotate TophatterMerchant::Order.annotate(60157972, ‘Testing…’).annotation



64
65
66
# File 'lib/tophatter_merchant/order.rb', line 64

def annotate(id, annotation)
  Order.new post(url: "#{path}/annotate.json", params: { order_id: id, annotation: annotation })
end

.fulfill(id, carrier:, tracking_number:) ⇒ Object

merchant-api.tophatter.com/docs/order-fulfill TophatterMerchant::Order.fulfill(417953232, carrier: ‘other’, tracking_number: ‘ABC123’)



51
52
53
# File 'lib/tophatter_merchant/order.rb', line 51

def fulfill(id, carrier:, tracking_number:)
  Order.new post(url: "#{path}/fulfill.json", params: { order_id: id, carrier: carrier, tracking_number: tracking_number })
end

.refund(id, type:, reason:, fees: []) ⇒ Object

merchant-api.tophatter.com/docs/order-refund TophatterMerchant::Order.refund(417953232, type: ‘full’, reason: ‘delay_in_shipping’) TophatterMerchant::Order.refund(417953232, type: ‘partial’, reason: ‘other’, fees: [‘shipping_fee’])



58
59
60
# File 'lib/tophatter_merchant/order.rb', line 58

def refund(id, type:, reason:, fees: [])
  Order.new post(url: "#{path}/refund.json", params: { order_id: id, type: type, reason: reason, fees: fees })
end

.retrieve(id) ⇒ Object

merchant-api.tophatter.com/docs/order-retrieve TophatterMerchant::Order.retrieve(60150685)



39
40
41
# File 'lib/tophatter_merchant/order.rb', line 39

def retrieve(id)
  Order.new get(url: "#{path}/retrieve.json", params: { order_id: id })
end