Class: ExportoAPI::Base
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ExportoAPI::Base
- Defined in:
- lib/exporto_api/object.rb
Direct Known Subclasses
Objects::LabelMethodResponse, Objects::LabelResponse, Objects::ReturnShipmentResponse, Objects::ShipmentResponse, Objects::TokenResponse
Instance Attribute Summary collapse
-
#original_response ⇒ Object
readonly
Returns the value of attribute original_response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Base
constructor
A new instance of Base.
- #raw ⇒ Object
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(attributes) ⇒ Base
Returns a new instance of Base.
16 17 18 19 |
# File 'lib/exporto_api/object.rb', line 16 def initialize(attributes) @original_response = deep_freeze(attributes) super(to_ostruct(attributes)) end |
Instance Attribute Details
#original_response ⇒ Object (readonly)
Returns the value of attribute original_response.
8 9 10 |
# File 'lib/exporto_api/object.rb', line 8 def original_response @original_response end |
Class Method Details
.new(attributes) ⇒ Object
10 11 12 13 14 |
# File 'lib/exporto_api/object.rb', line 10 def self.new(attributes) return attributes.map { |item| super(item) } if attributes.is_a?(Array) super end |
Instance Method Details
#raw ⇒ Object
27 28 29 |
# File 'lib/exporto_api/object.rb', line 27 def raw @original_response end |
#to_hash ⇒ Object Also known as: to_h
21 22 23 |
# File 'lib/exporto_api/object.rb', line 21 def to_hash ostruct_to_hash(self) end |