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