Class: Etsy::Receipt

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/etsy/receipt.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

included, #initialize, #result, #secret, #token

Class Method Details

.find(*identifiers_and_options) ⇒ Object



14
15
16
# File 'lib/etsy/receipt.rb', line 14

def self.find(*identifiers_and_options)
  find_one_or_more('receipts', identifiers_and_options)
end

.find_all_by_shop_id(shop_id, options = {}) ⇒ Object



18
19
20
# File 'lib/etsy/receipt.rb', line 18

def self.find_all_by_shop_id(shop_id, options = {})
  get_all("/shops/#{shop_id}/receipts", options)
end

.find_all_by_shop_id_and_status(shop_id, status, options = {}) ⇒ Object



22
23
24
# File 'lib/etsy/receipt.rb', line 22

def self.find_all_by_shop_id_and_status(shop_id, status, options = {})
  get_all("/shops/#{shop_id}/receipts/#{status}", options)
end

Instance Method Details

#buyerObject



30
31
32
# File 'lib/etsy/receipt.rb', line 30

def buyer
  @buyer ||= User.find(buyer_id)
end

#created_atObject



26
27
28
# File 'lib/etsy/receipt.rb', line 26

def created_at
  Time.at(created)
end

#transactionsObject



34
35
36
37
38
39
40
41
# File 'lib/etsy/receipt.rb', line 34

def transactions
  unless @transactions
    options = {}
    options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)
    @transactions = Transaction.find_all_by_receipt_id(id, options)
  end
  @transactions
end