Class: ObjectJSONMapper::Associations::HasOne
- Inherits:
-
Association
- Object
- Association
- ObjectJSONMapper::Associations::HasOne
- Defined in:
- lib/object_json_mapper/associations/has_one.rb
Instance Attribute Summary
Attributes inherited from Association
Instance Method Summary collapse
Methods inherited from Association
#endpoint, #initialize, #klass
Constructor Details
This class inherits a constructor from ObjectJSONMapper::Associations::Association
Instance Method Details
#call(object) ⇒ ObjectJSONMapper::Base
6 7 8 9 10 11 |
# File 'lib/object_json_mapper/associations/has_one.rb', line 6 def call(object) attributes = object[name] attributes ||= HTTP.parse_json(object.client[endpoint].get.body) klass.persist(attributes) end |