Module: Snafu::Locations

Included in:
Client
Defined in:
lib/snafu/locations.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) get_hub(hub_id)

Accesses the "locations.getStreets" method from the Glitch API passing in the supplied Hub ID.



28
29
30
31
# File 'lib/snafu/locations.rb', line 28

def get_hub(hub_id)
  response = self.call("locations.getStreets", :hub_id => hub_id)
  Models::Hub.new(response)
end

- (Object) get_hubs

Accesses the "locations.getHubs" method from the Glitch API and returns an Array of the returned Hub information.



7
8
9
10
11
12
13
14
# File 'lib/snafu/locations.rb', line 7

def get_hubs
  hubs = []
  response = self.call("locations.getHubs")
  response["hubs"].each do |key,value|
    hubs << Models::Hub.new(:id => key, :name => value["name"])
  end
  hubs
end

- (Object) get_hubs!

A variant of the get_hubs method which makes two calls to the Glitch API:

  1. locations.getHubs to retrieve all hubs in Glitch

  2. locations.getStreets for each hub returned from locations.getHubs



21
22
23
# File 'lib/snafu/locations.rb', line 21

def get_hubs!
  # TODO
end

- (Object) get_street(street_id)

Accesses the "locations.streetInfo" method from the Glitch API padding in the supplied street ID



36
37
38
39
# File 'lib/snafu/locations.rb', line 36

def get_street(street_id)
  response = self.call("locations.streetInfo", :street_tsid => street_id)
  Models::Street.new(response)
end