Class: Klarna::Checkout::CartItem

Inherits:
Resource
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/klarna/checkout/cart_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

defaults, defaults=, #initialize, #json_sanitize, #to_json

Methods included from HasOne

#has_one

Methods included from HasMany

#has_many

Constructor Details

This class inherits a constructor from Klarna::Checkout::Resource

Instance Attribute Details

#discount_rateObject

Returns the value of attribute discount_rate.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def discount_rate
  @discount_rate
end

#eanObject

Returns the value of attribute ean.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def ean
  @ean
end

#image_uriObject

Returns the value of attribute image_uri.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def image_uri
  @image_uri
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def name
  @name
end

#quantityObject

Returns the value of attribute quantity.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def quantity
  @quantity
end

#referenceObject

Returns the value of attribute reference.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def reference
  @reference
end

#tax_rateObject

Returns the value of attribute tax_rate.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def tax_rate
  @tax_rate
end

#total_price_excluding_taxObject

Returns the value of attribute total_price_excluding_tax.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def total_price_excluding_tax
  @total_price_excluding_tax
end

#total_price_including_taxObject

Returns the value of attribute total_price_including_tax.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def total_price_including_tax
  @total_price_including_tax
end

#total_tax_amountObject

Returns the value of attribute total_tax_amount.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def total_tax_amount
  @total_tax_amount
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def type
  @type
end

#unit_priceObject

Returns the value of attribute unit_price.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def unit_price
  @unit_price
end

#uriObject

Returns the value of attribute uri.



8
9
10
# File 'lib/klarna/checkout/cart_item.rb', line 8

def uri
  @uri
end

Instance Method Details

#as_jsonObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/klarna/checkout/cart_item.rb', line 14

def as_json
  json_sanitize({
    :type => @type,
    :ean => @ean,
    :reference => @reference,
    :name => @name,
    :uri => @uri,
    :image_uri => @image_uri,
    :quantity => @quantity,
    :unit_price => @unit_price,
    :discount_rate => @discount_rate,
    :tax_rate => @tax_rate
  })
end