Class: FullCircle::ObjectBuilder
- Inherits:
-
Object
- Object
- FullCircle::ObjectBuilder
- Defined in:
- lib/full_circle/object_builder.rb
Instance Method Summary collapse
- #from_api_hash(hash) ⇒ Object
-
#initialize(cls = OpenStruct) ⇒ ObjectBuilder
constructor
This class takes a hash from the api response and builds the appropriate object.
Constructor Details
#initialize(cls = OpenStruct) ⇒ ObjectBuilder
This class takes a hash from the api response and builds the appropriate object.
cls - Class responding to initialize(hash) that takes a hash and sets
its instance variables
11 12 13 |
# File 'lib/full_circle/object_builder.rb', line 11 def initialize(cls=OpenStruct) @cls = cls end |
Instance Method Details
#from_api_hash(hash) ⇒ Object
15 16 17 18 |
# File 'lib/full_circle/object_builder.rb', line 15 def from_api_hash(hash) @cls.new underscore_hash_keys(hash) end |