Class: Access::Api

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

Instance Method Summary collapse

Instance Method Details

#all_usage(options = {}) ⇒ Object

Report



330
331
332
333
334
335
# File 'lib/access/api.rb', line 330

def all_usage(options = {})
  # Internal Admin only Call
  request.get("/all_usage", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#autocomplete(options = {}) ⇒ Object

Autocomplete



76
77
78
79
80
# File 'lib/access/api.rb', line 76

def autocomplete(options = {})
  request.get("/autocomplete", "offer", options) do |response|
    AutocompleteResponse.new(response)
  end
end

#create_oauth_application(options = {}) ⇒ Object



274
275
276
277
278
279
280
# File 'lib/access/api.rb', line 274

def create_oauth_application(options = {})
  # Internal Admin only Call
  request.create("/oauth_applications", 'token', options) do |response|
    OauthApplicationResponse.new(response)
  end
  # create("/oauth_applications", 'token', options)
end

#create_oauth_application_token(application_key, options = {}) ⇒ Object



265
266
267
268
269
270
271
272
# File 'lib/access/api.rb', line 265

def create_oauth_application_token(application_key, options = {})
  # Internal Admin only Call
  request.create("/oauth_applications/#{application_key}/access_tokens", 'token', options) do |response|
    # TokenResponse.new(response)
    # OauthApplicationResponse.new(response)
  end
  # create("/oauth_applications/#{application_key}/access_tokens", 'token', options)
end

#delete_oauth_application(application_key, options = {}) ⇒ Object



290
291
292
293
294
295
296
# File 'lib/access/api.rb', line 290

def delete_oauth_application(application_key, options = {})
  # Internal Admin only Call
  request.delete("/oauth_applications/#{application_key}", 'token', options) do |response|
    OauthApplication.new(response)
  end
  # delete("/oauth_applications/#{application_key}", 'token', options)
end

#favorites_create(resource_id, options = {}) ⇒ Object



389
390
391
392
393
# File 'lib/access/api.rb', line 389

def favorites_create(resource_id, options = {})
  request.post("/members/#{options.delete(:member_key)}/favorites/#{options.delete(:favorite_type)}/#{resource_id}", "mms", options) do |response|
    FavoriteResponse.new(response)
  end
end

#favorites_delete(resource_id, options = {}) ⇒ Object



395
396
397
398
399
# File 'lib/access/api.rb', line 395

def favorites_delete(resource_id, options = {})
  request.delete("/members/#{options.delete(:member_key)}/favorites/#{options.delete(:favorite_type)}/#{resource_id}", "mms", options) do |response|
    FavoriteResponse.new(response)
  end
end

#favorites_find(resource_id, options = {}) ⇒ Object



383
384
385
386
387
# File 'lib/access/api.rb', line 383

def favorites_find(resource_id, options = {})
  request.get("/members/#{options.delete(:member_key)}/favorites/#{options.delete(:favorite_type)}/#{resource_id}", "report", options) do |response|
    FavoriteResponse.new(response)
  end
end

#favorites_search(options = {}) ⇒ Object

Favorites



377
378
379
380
381
# File 'lib/access/api.rb', line 377

def favorites_search(options = {})
  request.get("/members/#{options.delete(:member_key)}/favorites/#{options.delete(:favorite_type)}", "report", options) do |response|
    FavoriteResponse.new(response)
  end
end

#find_campaign(campaign_key, options = {}) ⇒ Object



117
118
119
120
121
# File 'lib/access/api.rb', line 117

def find_campaign(campaign_key, options = {})
  request.get("/campaigns/#{campaign_key}", "campaign", options) do |response|
    CampaignResponse.new(response)
  end
end

#find_category(category_key, options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/access/api.rb', line 11

def find_category(category_key, options = {})
  request.get("/categories/#{category_key}", "offer", options) do |response|
    CategoryResponse.new(response)
  end
end

#find_channel(channel_key, options = {}) ⇒ Object



104
105
106
107
108
# File 'lib/access/api.rb', line 104

def find_channel(channel_key, options = {})
  request.get("/channels/#{channel_key}", "campaign", options) do |response|
    ChannelResponse.new(response)
  end
end

#find_device(member_key, options = {}) ⇒ Object



193
194
195
196
197
# File 'lib/access/api.rb', line 193

def find_device(member_key, options = {})
  request.get("/members/#{member_key}/devices/#{options.delete(:udid)}", 'mms', options) do |response|
    DeviceResponse.new(response)
  end
end

#find_filter(application_key, options = {}) ⇒ Object



229
230
231
232
233
234
# File 'lib/access/api.rb', line 229

def find_filter(application_key, options = {})
  # Internal Admin only Call
  request.get("/filters/#{application_key}", "token", options) do |response|
    FilterResponse.new(response)
  end
end

#find_location(location_key, options = {}) ⇒ Object



50
51
52
53
54
# File 'lib/access/api.rb', line 50

def find_location(location_key, options = {})
  request.get("/locations/#{location_key}", "offer", options) do |response|
    LocationResponse.new(response)
  end
end

#find_oauth_application(application_key, options = {}) ⇒ Object



244
245
246
247
248
249
# File 'lib/access/api.rb', line 244

def find_oauth_application(application_key, options = {})
  # Internal Admin only Call
  request.get("/oauth_applications/#{application_key}", 'token', options) do |response|
    OauthApplicationResponse.new(response)
  end
end

#find_oauth_application_token(application_key, token_key, options = {}) ⇒ Object



258
259
260
261
262
263
# File 'lib/access/api.rb', line 258

def find_oauth_application_token(application_key, token_key, options = {})
  # Internal Admin only Call
  request.get("/oauth_applications/#{application_key}/access_tokens/#{token_key}", 'token', options) do |response|
    TokenResponse.new(response)
  end
end

#find_offer(offer_key, options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/access/api.rb', line 24

def find_offer(offer_key, options = {})
  request.get("/offers/#{offer_key}", "offer", options) do |response|
    OfferResponse.new(response)
  end
end

#find_offer_redemptions_by_member(member_key, usage_redeem_key, options = {}) ⇒ Object



213
214
215
216
217
# File 'lib/access/api.rb', line 213

def find_offer_redemptions_by_member(member_key, usage_redeem_key, options = {})
  request.get("/members/#{member_key}/offer_redemptions/#{usage_redeem_key}", "report", options) do |response|
    RedemptionResponse.new(response)
  end
end

#find_offer_uses_remaining(offer_key, options = {}) ⇒ Object



30
31
32
33
34
# File 'lib/access/api.rb', line 30

def find_offer_uses_remaining(offer_key, options = {})
  request.get("/offers/#{offer_key}/uses_remaining", "offer", options) do |response|
    OfferResponse.new(response)
  end
end

#find_program_provisioning_method(pcid) ⇒ Object

Program



200
201
202
203
204
# File 'lib/access/api.rb', line 200

def find_program_provisioning_method(pcid)
  request.get("/programs/#{pcid}", "mms") do |response|
    ProgramResponse.new(response)
  end
end

#find_spot(spot_key, options = {}) ⇒ Object



136
137
138
139
140
# File 'lib/access/api.rb', line 136

def find_spot(spot_key, options = {})
  request.get("/spots/#{spot_key}", "campaign", options) do |response|
    SpotResponse.new(response)
  end
end

#find_store(store_key, options = {}) ⇒ Object



63
64
65
66
67
# File 'lib/access/api.rb', line 63

def find_store(store_key, options = {})
  request.get("/stores/#{store_key}", "offer", options) do |response|
    StoreResponse.new(response)
  end
end

#find_token(token, options = {}) ⇒ Object



306
307
308
309
310
311
312
# File 'lib/access/api.rb', line 306

def find_token(token, options = {})
  # Internal Admin only Call
  # new verify_other
  request.get("/tokens/#{token}", "token", options) do |response|
    TokenResponse.new(response)
  end
end

#geolocation_find(options = {}) ⇒ Object



409
410
411
412
413
# File 'lib/access/api.rb', line 409

def geolocation_find(options = {})
  request.get('/geolocation/find_location', 'offer', options) do |response|
    GeolocationResponse.new(response)
  end
end

#geolocation_search(options = {}) ⇒ Object

Geolocation



403
404
405
406
407
# File 'lib/access/api.rb', line 403

def geolocation_search(options = {})
  request.get('/geolocation', 'offer', options) do |response|
    GeolocationResponse.new(response)
  end
end

#get_shopping_cart_count(options = {}) ⇒ Object



415
416
417
418
419
# File 'lib/access/api.rb', line 415

def get_shopping_cart_count(options= {})
  request.get('/cart/count', 'shoppingcart', options) do |response|
    ShoppingCartResponse.new(response)
  end
end

#import_members(members, options = {}) ⇒ Object

AMT



423
424
425
426
427
# File 'lib/access/api.rb', line 423

def import_members(members, options = {})
  request.post('/imports', 'amt', options.merge({import: {members: members}})) do |response|
    AmtResponse.new(response)
  end
end

#list_imports(options = {}) ⇒ Object



429
430
431
432
433
# File 'lib/access/api.rb', line 429

def list_imports(options = {})
  request.get('/imports', 'amt', options) do |response|
    AmtResponse.new(response)
  end
end

#member_location_frequent(member, options = {}) ⇒ Object



363
364
365
366
367
# File 'lib/access/api.rb', line 363

def member_location_frequent(member, options = {})
  request.get("/members/#{member}/locations/frequent", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#member_location_recent(member, options = {}) ⇒ Object



369
370
371
372
373
# File 'lib/access/api.rb', line 369

def member_location_recent(member, options = {})
  request.get("/members/#{member}/locations/recent", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#member_query_frequent(member, options = {}) ⇒ Object



351
352
353
354
355
# File 'lib/access/api.rb', line 351

def member_query_frequent(member, options = {})
  request.get("/members/#{member}/queries/frequent", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#member_query_recent(member, options = {}) ⇒ Object



357
358
359
360
361
# File 'lib/access/api.rb', line 357

def member_query_recent(member, options = {})
  request.get("/members/#{member}/queries/recent", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#member_show(member_key, options = {}) ⇒ Object

Member



174
175
176
177
178
# File 'lib/access/api.rb', line 174

def member_show(member_key, options = {})
  request.get("/members/#{member_key}", 'mms', options) do |response|
    MemberResponse.new(response)
  end
end

#member_update(member_key, options = {}) ⇒ Object



180
181
182
183
184
# File 'lib/access/api.rb', line 180

def member_update(member_key, options = {})
  request.put("/members/#{member_key}?program_id=#{options.delete(:program_id)}", 'mms', options) do |response|
    MemberResponse.new(response)
  end
end

#national_stores(options = {}) ⇒ Object



69
70
71
72
73
# File 'lib/access/api.rb', line 69

def national_stores(options={})
  request.get("/stores/national", "offer", options) do |response|
    StoreResponse.new(response)
  end
end

#redeem_offer(offer_key, redeem_type = nil, options = {}) ⇒ Object

Redeem



83
84
85
86
87
# File 'lib/access/api.rb', line 83

def redeem_offer(offer_key, redeem_type = nil, options = {})
  request.get("/redeem/#{offer_key}/#{redeem_type}", "redeem", options) do |response|
    RedeemResponse.new(response)
  end
end

#search_campaigns(options = {}) ⇒ Object

Campaign



111
112
113
114
115
# File 'lib/access/api.rb', line 111

def search_campaigns(options = {})
  request.get("/campaigns", "campaign", options) do |response|
    CampaignResponse.new(response)
  end
end

#search_categories(options = {}) ⇒ Object

Categories



5
6
7
8
9
# File 'lib/access/api.rb', line 5

def search_categories(options = {})
  request.get("/categories", "offer", options) do |response|
    CategoryResponse.new(response)
  end
end

#search_channels(options = {}) ⇒ Object

Channel



98
99
100
101
102
# File 'lib/access/api.rb', line 98

def search_channels(options = {})
  request.get("/channels", "campaign", options) do |response|
    ChannelResponse.new(response)
  end
end

#search_city_savings(options = {}) ⇒ Object

CitySavings



90
91
92
93
94
95
# File 'lib/access/api.rb', line 90

def search_city_savings(options = {})
  # this is broken
  request.get("/citysavings", "allcitysavings", options) do |response|
    CitySavingsResponse.new(response)
  end
end

#search_devices(member_key, options = {}) ⇒ Object

Device



187
188
189
190
191
# File 'lib/access/api.rb', line 187

def search_devices(member_key, options = {})
  request.get("/members/#{member_key}/devices", 'mms', options) do |response|
    DeviceResponse.new(response)
  end
end

#search_filters(options = {}) ⇒ Object

Filters



222
223
224
225
226
227
# File 'lib/access/api.rb', line 222

def search_filters(options = {})
  # Internal Admin only Call
  request.get("/filters", "token", options) do |response|
    FilterResponse.new(response)
  end
end

#search_locations(options = {}) ⇒ Object

Locations



44
45
46
47
48
# File 'lib/access/api.rb', line 44

def search_locations(options = {})
  request.get("/locations", "offer", options) do |response|
    LocationResponse.new(response)
  end
end

#search_oauth_application_tokens(application_key, options = {}) ⇒ Object



251
252
253
254
255
256
# File 'lib/access/api.rb', line 251

def search_oauth_application_tokens(application_key, options = {})
  # Internal Admin only Call
  request.get("/oauth_applications/#{application_key}/access_tokens", 'token', options) do |response|
    TokenResponse.new(response)
  end
end

#search_oauth_applications(options = {}) ⇒ Object

Oauth Applications



237
238
239
240
241
242
# File 'lib/access/api.rb', line 237

def search_oauth_applications(options = {})
  # Internal Admin only Call
  request.get("/oauth_applications", 'token', options) do |response|
    OauthApplicationResponse.new(response)
  end
end

#search_offer_redemptions_by_member(member_key, options = {}) ⇒ Object

Offer Redemptions



207
208
209
210
211
# File 'lib/access/api.rb', line 207

def search_offer_redemptions_by_member(member_key, options = {})
  request.get("/members/#{member_key}/offer_redemptions", "report", options) do |response|
    RedemptionResponse.new(response)
  end
end

#search_offers(options = {}) ⇒ Object

Offers



18
19
20
21
22
# File 'lib/access/api.rb', line 18

def search_offers(options = {})
  request.get("/offers", "offer", options) do |response|
    OfferResponse.new(response)
  end
end

#search_product_groups(options = {}) ⇒ Object

Product Groups



37
38
39
40
41
# File 'lib/access/api.rb', line 37

def search_product_groups(options = {})
  request.get("/product_groups", "offer", options) do |response|
    ProductGroupResponse.new(response)
  end
end

#search_spots_by_campaign(campaign_key, options = {}) ⇒ Object



130
131
132
133
134
# File 'lib/access/api.rb', line 130

def search_spots_by_campaign(campaign_key, options = {})
  request.get("/spots/campaign/#{campaign_key}", "campaign", options) do |response|
    SpotResponse.new(response)
  end
end

#search_spots_by_channel(channel_key, options = {}) ⇒ Object

Spot



124
125
126
127
128
# File 'lib/access/api.rb', line 124

def search_spots_by_channel(channel_key, options = {})
  request.get("/spots/channel/#{channel_key}", "campaign", options) do |response|
    SpotResponse.new(response)
  end
end

#search_stores(options = {}) ⇒ Object

Stores



57
58
59
60
61
# File 'lib/access/api.rb', line 57

def search_stores(options = {})
  request.get("/stores", "offer", options) do |response|
    StoreResponse.new(response)
  end
end

#search_tokens(options = {}) ⇒ Object

Access Tokens



299
300
301
302
303
304
# File 'lib/access/api.rb', line 299

def search_tokens(options = {})
  # Internal Admin only Call
  request.get("/tokens", 'token', options) do |response|
    TokenResponse.new(response)
  end
end

#show_import(import_key, options = {}) ⇒ Object



435
436
437
438
439
# File 'lib/access/api.rb', line 435

def show_import(import_key, options = {})
  request.get("/imports/#{import_key}", 'amt', options) do |response|
    AmtResponse.new(response)
  end
end

#update_oauth_application(application_key, batch = {}) ⇒ Object



282
283
284
285
286
287
288
# File 'lib/access/api.rb', line 282

def update_oauth_application(application_key, batch= {})
  # Internal Admin only Call
  request.put("/oauth_applications/#{application_key}", 'token', options) do |response|
    OauthApplicationResponse.new(response)
  end
  # put("/oauth_applications/#{application_key}", 'token', options)
end

#usage(options = {}) ⇒ Object



337
338
339
340
341
342
# File 'lib/access/api.rb', line 337

def usage(options = {})
  # Internal Admin only Call
  request.get("/usage", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#usage_other(token, options = {}) ⇒ Object



344
345
346
347
348
349
# File 'lib/access/api.rb', line 344

def usage_other(token, options = {})
  # Internal Admin only Call
  request.get("/usage/#{token}", "report", options) do |response|
    ReportResponse.new(response)
  end
end

#user_authentication(options = {}) ⇒ Object



155
156
157
158
159
# File 'lib/access/api.rb', line 155

def user_authentication(options = {})
  request.post("/auth", "mms", options) do |response|
    UserResponse.new(response)
  end
end

#user_authentication_by_cvt(options = {}) ⇒ Object



161
162
163
164
165
# File 'lib/access/api.rb', line 161

def user_authentication_by_cvt(options = {})
  request.get("/auth", "mms", options) do |response|
    UserResponse.new(response)
  end
end

#user_authentication_by_member_key(options = {}) ⇒ Object



167
168
169
170
171
# File 'lib/access/api.rb', line 167

def user_authentication_by_member_key(options = {})
  request.get("/auth", "mms", options) do |response|
    UserResponse.new(response)
  end
end

#user_registration(options = {}) ⇒ Object

User



143
144
145
146
147
# File 'lib/access/api.rb', line 143

def user_registration(options = {})
  request.post("/register", "mms", options) do |response|
    UserResponse.new(response)
  end
end

#user_update(options = {}) ⇒ Object



149
150
151
152
153
# File 'lib/access/api.rb', line 149

def user_update(options = {})
  request.put("/users", "mms", options) do |response|
    UserResponse.new(response)
  end
end

#verify_filter(filter, options = {}) ⇒ Object



322
323
324
325
326
327
# File 'lib/access/api.rb', line 322

def verify_filter(filter, options = {})
  # Internal Admin only Call
  request.post_for_filter("/filter", 'token', filter, options) do |response|
    VerifyResponse.new(response)
  end
end

#verify_token(options = {}) ⇒ Object

Verify



315
316
317
318
319
320
# File 'lib/access/api.rb', line 315

def verify_token(options = {})
  # Internal Admin only Call
  request.get("/verify", 'token', options) do |response|
    VerifyResponse.new(response)
  end
end