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
#==, #assign_attributes, #attributes, #to_json
Constructor Details
#initialize(payload = {}) ⇒ Position
105 106 107 108 109 |
# File 'lib/orange_data/receipt.rb', line 105 def initialize(payload={}) @payload = 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.
128 129 130 |
# File 'lib/orange_data/receipt.rb', line 128 def agent_info @agent_info end |
#supplier_info ⇒ Object (readonly)
Returns the value of attribute supplier_info.
128 129 130 |
# File 'lib/orange_data/receipt.rb', line 128 def supplier_info @supplier_info end |
Instance Method Details
#set_agent_info(**options) ⇒ Object
123 124 125 126 |
# File 'lib/orange_data/receipt.rb', line 123 def set_agent_info(**) @agent_info = AgentInfo.new.assign_attributes() self end |
#set_supplier_info(**options) ⇒ Object
118 119 120 121 |
# File 'lib/orange_data/receipt.rb', line 118 def set_supplier_info(**) @supplier_info = SupplierInfo.new.assign_attributes() self end |
#to_hash ⇒ Object
111 112 113 114 115 116 |
# File 'lib/orange_data/receipt.rb', line 111 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 |