Class: Gonebusy::GetResourcesResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/get_resources_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(resources = nil) ⇒ GetResourcesResponse

Returns a new instance of GetResourcesResponse.



18
19
20
# File 'lib/gonebusy/models/get_resources_response.rb', line 18

def initialize(resources = nil)
  @resources = resources
end

Instance Attribute Details

#resourcesList of EntitiesResourceResponse

TODO: Write general description for this method

Returns:



7
8
9
# File 'lib/gonebusy/models/get_resources_response.rb', line 7

def resources
  @resources
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gonebusy/models/get_resources_response.rb', line 23

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash
  # Parameter is an array, so we need to iterate through it
  resources = nil
  if hash['resources'] != nil
    resources = Array.new
    hash['resources'].each{|structure| resources << (EntitiesResourceResponse.from_hash(structure) if structure)}
  end

  # Create object from extracted values
  GetResourcesResponse.new(resources)
end

.namesObject

A mapping from model property names to API property names



10
11
12
13
14
15
16
# File 'lib/gonebusy/models/get_resources_response.rb', line 10

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["resources"] = "resources"
  end
  @_hash
end