Class: PaysonAPI::V2::Models::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/v2/models/order.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def currency
  @currency
end

#itemsObject

Returns the value of attribute items.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def items
  @items
end

#total_credited_amountObject

Returns the value of attribute total_credited_amount.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_credited_amount
  @total_credited_amount
end

#total_fee_excluding_taxObject

Returns the value of attribute total_fee_excluding_tax.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_fee_excluding_tax
  @total_fee_excluding_tax
end

#total_fee_including_taxObject

Returns the value of attribute total_fee_including_tax.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_fee_including_tax
  @total_fee_including_tax
end

#total_price_excluding_taxObject

Returns the value of attribute total_price_excluding_tax.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_price_excluding_tax
  @total_price_excluding_tax
end

#total_price_including_taxObject

Returns the value of attribute total_price_including_tax.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_price_including_tax
  @total_price_including_tax
end

#total_tax_amountObject

Returns the value of attribute total_tax_amount.



7
8
9
# File 'lib/payson_api/v2/models/order.rb', line 7

def total_tax_amount
  @total_tax_amount
end

Class Method Details

.from_hash(hash) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/payson_api/v2/models/order.rb', line 11

def self.from_hash(hash)
  new.tap do |order|
    order.currency = hash['currency']
    order.total_fee_excluding_tax = hash['totalFeeExcludingTax']
    order.total_fee_including_tax = hash['totalFeeIncludingTax']
    order.total_price_excluding_tax = hash['totalPriceIncludingTax']
    order.total_price_including_tax = hash['totalPriceIncludingTax']
    order.total_tax_amount = hash['totalTaxAmount']
    order.total_credited_amount = hash['totalCreditedAmount']

    if hash['items']
      order.items = []
      hash['items'].each do |item|
        order.items << PaysonAPI::V2::Models::OrderItem.from_hash(item)
      end
    end
  end
end