Class: Ordrin::APIs

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

Instance Method Summary collapse

Constructor Details

#initialize(api_key, servers = :test) ⇒ APIs

Returns a new instance of APIs.



5
6
7
# File 'lib/ordrin.rb', line 5

def initialize(api_key, servers=:test)
  @helper = APIHelper.new(api_key, servers)
end

Instance Method Details

#change_password(args) ⇒ Object

user endpoints



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/ordrin.rb', line 162

def change_password(args)
=begin
  Arguments:
email--The user's email address
password--The user's new password
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "change_password", ["email"], args)
end

#create_account(args) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/ordrin.rb', line 176

def (args)
=begin
  Arguments:
email--The user's email address
pw--The user's password
first_name--The user's first name
last_name--The user's last name

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "create_account", ["email"], args)
end

#create_addr(args) ⇒ Object



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/ordrin.rb', line 191

def create_addr(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
phone--The customer's phone number
zip--The zip code part of the address
addr--The street address
city--The city part of the address
state--The state part of the address
current_password -- The user's current password

Keyword Arguments:
addr2--The second part of the street address, if needed


=end
  @helper.call_endpoint(:user, "create_addr", ["email", "nick"], args)
end

#create_cc(args) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/ordrin.rb', line 211

def create_cc(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
card_number--Credit card number
card_cvc--3 or 4 digit security code
card_expiry--The credit card expiration date.
bill_addr--The credit card's billing street address
bill_city--The credit card's billing city
bill_state--The credit card's billing state
bill_zip--The credit card's billing zip code
bill_phone--The credit card's billing phone number
current_password -- The user's current password

Keyword Arguments:
bill_addr2--The second part of the credit card's biling street address.


=end
  @helper.call_endpoint(:user, "create_cc", ["email", "nick"], args)
end

#delete_addr(args) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/ordrin.rb', line 234

def delete_addr(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "delete_addr", ["email", "nick"], args)
end

#delete_cc(args) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/ordrin.rb', line 248

def delete_cc(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "delete_cc", ["email", "nick"], args)
end

#delivery_check(args) ⇒ Object

restaurant endpoints



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

def delivery_check(args)
=begin
  Arguments:
datetime--Delivery date and time
rid--Ordr.in's unique restaurant identifier for the restaurant.
addr--Delivery location street address
city--Delivery location city
zip--The zip code part of the address

Keyword Arguments:


=end
  @helper.call_endpoint(:restaurant, "delivery_check", ["rid", "datetime", "zip", "city", "addr"], args)
end

#delivery_list(args) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/ordrin.rb', line 114

def delivery_list(args)
=begin
  Arguments:
datetime--Delivery date and time
addr--Delivery location street address
city--Delivery location city
zip--The zip code part of the address

Keyword Arguments:


=end
  @helper.call_endpoint(:restaurant, "delivery_list", ["datetime", "zip", "city", "addr"], args)
end

#fee(args) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/ordrin.rb', line 129

def fee(args)
=begin
  Arguments:
datetime--Delivery date and time
rid--Ordr.in's unique restaurant identifier for the restaurant.
subtotal--The cost of all items in the tray in dollars and cents.
tip--The tip in dollars and cents.
addr--Delivery location street address
city--Delivery location city
zip--The zip code part of the address

Keyword Arguments:


=end
  @helper.call_endpoint(:restaurant, "fee", ["rid", "subtotal", "tip", "datetime", "zip", "city", "addr"], args)
end

#get_account_info(args) ⇒ Object



262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/ordrin.rb', line 262

def (args)
=begin
  Arguments:
email--The user's email address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_account_info", ["email"], args)
end

#get_all_saved_addrs(args) ⇒ Object



275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/ordrin.rb', line 275

def get_all_saved_addrs(args)
=begin
  Arguments:
email--The user's email address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_all_saved_addrs", ["email"], args)
end

#get_all_saved_ccs(args) ⇒ Object



288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/ordrin.rb', line 288

def get_all_saved_ccs(args)
=begin
  Arguments:
email--The user's email address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_all_saved_ccs", ["email"], args)
end

#get_order(args) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/ordrin.rb', line 301

def get_order(args)
=begin
  Arguments:
email--The user's email address
oid--Ordr.in's unique order id number.
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_order", ["email", "oid"], args)
end

#get_order_history(args) ⇒ Object



315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/ordrin.rb', line 315

def get_order_history(args)
=begin
  Arguments:
email--The user's email address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_order_history", ["email"], args)
end

#get_saved_addr(args) ⇒ Object



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/ordrin.rb', line 328

def get_saved_addr(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_saved_addr", ["email", "nick"], args)
end

#get_saved_cc(args) ⇒ Object



342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/ordrin.rb', line 342

def get_saved_cc(args)
=begin
  Arguments:
email--The user's email address
nick--The nickname of this address
current_password -- The user's current password

Keyword Arguments:


=end
  @helper.call_endpoint(:user, "get_saved_cc", ["email", "nick"], args)
end

#order_guest(args) ⇒ Object

order endpoints



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ordrin.rb', line 12

def order_guest(args)
=begin
  Arguments:
rid--Ordr.in's unique restaurant identifier for the restaurant.
em--The customer's email address
tray--Represents a tray of menu items in the format '[menu item id]/[qty],[option id],...,[option id]'
tip--Tip amount in dollars and cents
first_name--The customer's first name
last_name--The customer's last name
phone--The customer's phone number
zip--The zip code part of the address
addr--The street address
city--The city part of the address
state--The state part of the address
card_number--Credit card number
card_cvc--3 or 4 digit security code
card_expiry--The credit card expiration date.
card_bill_addr--The credit card's billing street address
card_bill_city--The credit card's billing city
card_bill_state--The credit card's billing state
card_bill_zip--The credit card's billing zip code
card_bill_phone--The credit card's billing phone number

Keyword Arguments:
addr2--The second part of the street address, if needed
card_name--Full name as it appears on the credit card
card_bill_addr2--The second part of the credit card's biling street address.


Either
delivery_date--Delivery date
delivery_time--Delivery time
OR
delivery_date--Delivery date
=end
  @helper.call_endpoint(:order, "order_guest", ["rid"], args)
end

#order_user(args) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ordrin.rb', line 50

def order_user(args)
=begin
  Arguments:
rid--Ordr.in's unique restaurant identifier for the restaurant.
tray--Represents a tray of menu items in the format '[menu item id]/[qty],[option id],...,[option id]'
tip--Tip amount in dollars and cents
first_name--The customer's first name
last_name--The customer's last name
email -- The user's email
current_password -- The user's current password

Keyword Arguments:


Either
phone--The customer's phone number
zip--The zip code part of the address
addr--The street address
addr2--The second part of the street address, if needed
city--The city part of the address
state--The state part of the address
OR
nick--The delivery location nickname. (From the user's addresses)
Either
card_name--Full name as it appears on the credit card
card_number--Credit card number
card_cvc--3 or 4 digit security code
card_expiry--The credit card expiration date.
card_bill_addr--The credit card's billing street address
card_bill_addr2--The second part of the credit card's biling street address.
card_bill_city--The credit card's billing city
card_bill_state--The credit card's billing state
card_bill_zip--The credit card's billing zip code
card_bill_phone--The credit card's billing phone number
OR
card_nick--The credit card nickname. (From the user's credit cards)
Either
delivery_date--Delivery date
delivery_time--Delivery time
OR
delivery_date--Delivery date
=end
  @helper.call_endpoint(:order, "order_user", ["rid"], args)
end

#restaurant_details(args) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/ordrin.rb', line 147

def restaurant_details(args)
=begin
  Arguments:
rid--Ordr.in's unique restaurant identifier for the restaurant.

Keyword Arguments:


=end
  @helper.call_endpoint(:restaurant, "restaurant_details", ["rid"], args)
end