Class: R43::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/r43.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, query) ⇒ Response

This is only meant to be called by a R43::Connection object.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/r43.rb', line 97

def initialize(service, query)
  @service = service
  @query = query
  @has_object = false
  @objects = []
  @entries = []
  @people = []
  @goals = []
  @cities = []
  @tags = []
  @title = ""
  @max_in_page = 0
  @total_available = 0
  @next_offset = 0
  _from_xml(service.get_response(query))
end

Instance Attribute Details

#citiesObject (readonly)

Returns the value of attribute cities.



89
90
91
# File 'lib/r43.rb', line 89

def cities
  @cities
end

#cityObject

Returns the value of attribute city.



89
90
91
# File 'lib/r43.rb', line 89

def city
  @city
end

#entriesObject (readonly)

Returns the value of attribute entries.



89
90
91
# File 'lib/r43.rb', line 89

def entries
  @entries
end

#entryObject

Returns the value of attribute entry.



89
90
91
# File 'lib/r43.rb', line 89

def entry
  @entry
end

#goalObject

Returns the value of attribute goal.



89
90
91
# File 'lib/r43.rb', line 89

def goal
  @goal
end

#goalsObject (readonly)

Returns the value of attribute goals.



89
90
91
# File 'lib/r43.rb', line 89

def goals
  @goals
end

#has_objectObject (readonly)

Returns the value of attribute has_object.



89
90
91
# File 'lib/r43.rb', line 89

def has_object
  @has_object
end

#max_in_pageObject (readonly)

Returns the value of attribute max_in_page.



89
90
91
# File 'lib/r43.rb', line 89

def max_in_page
  @max_in_page
end

#next_offsetObject (readonly)

Returns the value of attribute next_offset.



89
90
91
# File 'lib/r43.rb', line 89

def next_offset
  @next_offset
end

#objectObject

Returns the value of attribute object.



89
90
91
# File 'lib/r43.rb', line 89

def object
  @object
end

#objectsObject (readonly)

Returns the value of attribute objects.



89
90
91
# File 'lib/r43.rb', line 89

def objects
  @objects
end

#peopleObject (readonly)

Returns the value of attribute people.



89
90
91
# File 'lib/r43.rb', line 89

def people
  @people
end

#personObject

Returns the value of attribute person.



89
90
91
# File 'lib/r43.rb', line 89

def person
  @person
end

#queryObject (readonly)

Returns the value of attribute query.



89
90
91
# File 'lib/r43.rb', line 89

def query
  @query
end

#serviceObject (readonly)

Returns the value of attribute service.



89
90
91
# File 'lib/r43.rb', line 89

def service
  @service
end

#tagsObject (readonly)

Returns the value of attribute tags.



89
90
91
# File 'lib/r43.rb', line 89

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



89
90
91
# File 'lib/r43.rb', line 89

def title
  @title
end

#total_availableObject (readonly)

Returns the value of attribute total_available.



89
90
91
# File 'lib/r43.rb', line 89

def total_available
  @total_available
end

#xmlObject (readonly)

Returns the value of attribute xml.



89
90
91
# File 'lib/r43.rb', line 89

def xml
  @xml
end

Instance Method Details

#moreObject

When a response hase been paged, the more method provides a simple mechanism for getting additional entries.

require 'r43'
connection = R43::Connection.new(<api_key>)
people = connection.get_goals_people(<goal_id>)
people += connection.more


123
124
125
126
# File 'lib/r43.rb', line 123

def more()
  clear_arrays()
  _populate_collections_from_xml(service.get_response(query + "&offset=#{@next_offset}"))
end