Class: OrangeData::ReceiptContent::Position
- Inherits:
-
PayloadContent
- Object
- PayloadContent
- OrangeData::ReceiptContent::Position
- Defined in:
- lib/orange_data/receipt.rb
Instance Attribute Summary collapse
-
#agent_info ⇒ Object
readonly
Returns the value of attribute agent_info.
-
#supplier_info ⇒ Object
readonly
Returns the value of attribute supplier_info.
Instance Method Summary collapse
-
#initialize(payload = {}) ⇒ Position
constructor
A new instance of Position.
- #set_agent_info(**options) ⇒ Object
- #set_supplier_info(**options) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from PayloadContent
#==, #as_json, #assign_attributes, #attributes, #to_json
Constructor Details
#initialize(payload = {}) ⇒ Position
Returns a new instance of Position.
125 126 127 128 129 |
# File 'lib/orange_data/receipt.rb', line 125 def initialize(payload={}) super(payload || {}) @supplier_info = SupplierInfo.new(@payload['supplierInfo']) if @payload['supplierInfo'] @agent_info = AgentInfo.new(@payload['agentInfo']) if @payload['agentInfo'] end |
Instance Attribute Details
#agent_info ⇒ Object (readonly)
Returns the value of attribute agent_info.
148 149 150 |
# File 'lib/orange_data/receipt.rb', line 148 def agent_info @agent_info end |
#supplier_info ⇒ Object (readonly)
Returns the value of attribute supplier_info.
148 149 150 |
# File 'lib/orange_data/receipt.rb', line 148 def supplier_info @supplier_info end |
Instance Method Details
#set_agent_info(**options) ⇒ Object
143 144 145 146 |
# File 'lib/orange_data/receipt.rb', line 143 def set_agent_info(**) @agent_info = AgentInfo.new.assign_attributes() self end |
#set_supplier_info(**options) ⇒ Object
138 139 140 141 |
# File 'lib/orange_data/receipt.rb', line 138 def set_supplier_info(**) @supplier_info = SupplierInfo.new.assign_attributes() self end |
#to_hash ⇒ Object
131 132 133 134 135 136 |
# File 'lib/orange_data/receipt.rb', line 131 def to_hash @payload.dup.tap{|h| h["supplierInfo"] = supplier_info.to_hash if supplier_info h["agentInfo"] = agent_info.to_hash if agent_info } end |