Class: Gonebusy::EntitiesSearchResponse
- Defined in:
- lib/gonebusy/models/entities_search_response.rb
Instance Attribute Summary collapse
-
#services ⇒ List of EntitiesServiceResponse
array of Services matching query.
-
#users ⇒ List of EntitiesUserResponse
array of Users matching query.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(services = nil, users = nil) ⇒ EntitiesSearchResponse
constructor
A new instance of EntitiesSearchResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(services = nil, users = nil) ⇒ EntitiesSearchResponse
Returns a new instance of EntitiesSearchResponse.
23 24 25 26 27 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 23 def initialize(services = nil, users = nil) @services = services @users = users end |
Instance Attribute Details
#services ⇒ List of EntitiesServiceResponse
array of Services matching query
7 8 9 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 7 def services @services end |
#users ⇒ List of EntitiesUserResponse
array of Users matching query
11 12 13 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 11 def users @users end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 30 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash # Parameter is an array, so we need to iterate through it services = nil if hash["services"] != nil services = Array.new hash["services"].each{|structure| services << (EntitiesServiceResponse.from_hash(structure) if structure)} end # Parameter is an array, so we need to iterate through it users = nil if hash["users"] != nil users = Array.new hash["users"].each{|structure| users << (EntitiesUserResponse.from_hash(structure) if structure)} end # Create object from extracted values EntitiesSearchResponse.new(services, users) end end |
.names ⇒ Object
A mapping from model property names to API property names
14 15 16 17 18 19 20 21 |
# File 'lib/gonebusy/models/entities_search_response.rb', line 14 def self.names if @hash.nil? @hash = {} @hash["services"] = "services" @hash["users"] = "users" end @hash end |