Class: APIStruct
- Inherits:
-
Struct
- Object
- Struct
- APIStruct
- Defined in:
- lib/ey_services_api/api_struct.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(atts = {}) ⇒ APIStruct
constructor
A new instance of APIStruct.
- #to_hash ⇒ Object
Constructor Details
#initialize(atts = {}) ⇒ APIStruct
Returns a new instance of APIStruct.
4 5 6 7 8 9 |
# File 'lib/ey_services_api/api_struct.rb', line 4 def initialize(atts = {}) #converting all keys of atts to Symbols @raw = atts atts = Hash[atts.map {|k,v| [k.to_sym, v]}] super(*atts.values_at(*self.members.map(&:to_sym))) end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
2 3 4 |
# File 'lib/ey_services_api/api_struct.rb', line 2 def raw @raw end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 |
# File 'lib/ey_services_api/api_struct.rb', line 11 def to_hash Hash[members.map(&:to_sym).zip(entries)] end |