Class: FullCircle::API

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ API

Returns a new instance of API.



6
7
8
# File 'lib/full_circle/api.rb', line 6

def initialize(connection)
  @connection=connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/full_circle/api.rb', line 4

def connection
  @connection
end

Instance Method Details

#fetch_coupons_for_ad(id) ⇒ Object



16
17
18
19
20
# File 'lib/full_circle/api.rb', line 16

def fetch_coupons_for_ad(id)
  parser = ResponseParser.new "ad.getCoupons", "coupon"
  response = connection.call_api_method("ad.getCoupons", adId: id)
  parser.parse response
end

#fetch_event_areasObject



22
23
24
25
26
# File 'lib/full_circle/api.rb', line 22

def fetch_event_areas()
  parser = ResponseParser.new "city.getEventAreas", "eventArea"
  response = connection.call_api_method("city.getEventAreas")
  parser.parse response
end

#fetch_events_for_ad(id) ⇒ Object



10
11
12
13
14
# File 'lib/full_circle/api.rb', line 10

def fetch_events_for_ad(id)
  parser = ResponseParser.new "ad.getEvents", "event"
  response = connection.call_api_method("ad.getEvents", adId: id)
  parser.parse response
end

#fetch_upcoming_events(params = {}) ⇒ Object



28
29
30
31
32
# File 'lib/full_circle/api.rb', line 28

def fetch_upcoming_events(params={})
  parser = ResponseParser.new "city.getUpcomingEvents", "event"
  response = connection.call_api_method("city.getUpcomingEvents", params)
  parser.parse response
end