Class: SixSaferpay::Item
- Inherits:
-
Object
- Object
- SixSaferpay::Item
- Defined in:
- lib/six_saferpay/models/item.rb
Instance Attribute Summary collapse
-
#category_name ⇒ Object
Returns the value of attribute category_name.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_pre_order ⇒ Object
Returns the value of attribute is_pre_order.
-
#name ⇒ Object
Returns the value of attribute name.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
-
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unit_price ⇒ Object
Returns the value of attribute unit_price.
-
#variant_id ⇒ Object
Returns the value of attribute variant_id.
Instance Method Summary collapse
-
#initialize(type: nil, id: nil, variant_id: nil, name: nil, category_name: nil, description: nil, quantity: nil, unit_price: nil, is_pre_order: nil, tax_rate: nil, tax_amount: nil, discount_amount: nil) ⇒ Item
constructor
A new instance of Item.
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(type: nil, id: nil, variant_id: nil, name: nil, category_name: nil, description: nil, quantity: nil, unit_price: nil, is_pre_order: nil, tax_rate: nil, tax_amount: nil, discount_amount: nil) ⇒ Item
Returns a new instance of Item.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/six_saferpay/models/item.rb', line 19 def initialize( type: nil, id: nil, variant_id: nil, name: nil, category_name: nil, description: nil, quantity: nil, unit_price: nil, is_pre_order: nil, tax_rate: nil, tax_amount: nil, discount_amount: nil ) @type = type @id = id @variant_id = variant_id @name = name @category_name = category_name @description = description @quantity = quantity @unit_price = unit_price @is_pre_order = is_pre_order @tax_rate = tax_rate @tax_amount = tax_amount @discount_amount = discount_amount end |
Instance Attribute Details
#category_name ⇒ Object
Returns the value of attribute category_name.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def category_name @category_name end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def id @id end |
#is_pre_order ⇒ Object
Returns the value of attribute is_pre_order.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def is_pre_order @is_pre_order end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def name @name end |
#quantity ⇒ Object
Returns the value of attribute quantity.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def quantity @quantity end |
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def tax_amount @tax_amount end |
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def tax_rate @tax_rate end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def type @type end |
#unit_price ⇒ Object
Returns the value of attribute unit_price.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def unit_price @unit_price end |
#variant_id ⇒ Object
Returns the value of attribute variant_id.
4 5 6 |
# File 'lib/six_saferpay/models/item.rb', line 4 def variant_id @variant_id end |
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/six_saferpay/models/item.rb', line 47 def to_hash hash = Hash.new hash.merge!(type: @type) if @type hash.merge!(id: @id) if @id hash.merge!(variant_id: @variant_id) if @variant_id hash.merge!(name: @name) if @name hash.merge!(category_name: @category_name) if @category_name hash.merge!(description: @description) if @description hash.merge!(quantity: @quantity) if @quantity hash.merge!(unit_price: @unit_price) if @unit_price hash.merge!(is_pre_order: @is_pre_order) if !@is_pre_order.nil? hash.merge!(tax_rate: @tax_rate) if @tax_rate hash.merge!(tax_amount: @tax_amount) if @tax_amount hash.merge!(discount_amount: @discount_amount) if @discount_amount hash end |