Class: BigDoor::Attribute
- Inherits:
-
ResourceWithAssociation
- Object
- OpenStruct
- Resource
- ResourceWithAssociation
- BigDoor::Attribute
- Defined in:
- lib/big_door/attribute.rb
Overview
This module provides Attribute Resource object corresponding to /attribute BigDoor API end point
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Attribute
constructor
Initialize new Attribute object with optional Hash.
Methods inherited from ResourceWithAssociation
Methods inherited from Resource
all, #delete, #end_point, end_point, end_point_from_classname, #get_id, #instance_to_payload, #load, #response_to_instance, #save
Constructor Details
#initialize(hash = {}) ⇒ Attribute
Initialize new Attribute object with optional Hash
13 14 15 16 17 18 19 |
# File 'lib/big_door/attribute.rb', line 13 def initialize( hash = {} ) $log.debug( "Attribute init with hash = #{hash.inspect}") default_values = { } default_values.merge!( hash ) $log.debug( "Attribute default_values = #{default_values.inspect}") super( default_values ) end |
Class Method Details
.search(friendly_id, client) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/big_door/attribute.rb', line 20 def self.search( friendly_id, client ) result = client.get( end_point , { 'format' => 'json', 'attribute_friendly_id' => friendly_id } ) $log.debug(sprintf 'result = %s', result.inspect ); found_objs = result.map{ |obj| $log.debug("obj = #{obj.inspect}") self.new(obj) } $log.debug( "found_objs = #{found_objs.inspect}") found_objs end |