ordrin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +6 -6
- data/README.md +94 -94
- data/bin/ordrindemo.rb +323 -323
- data/lib/ordrin/cacert.pem +3334 -0
- data/lib/ordrin/data.rb +148 -148
- data/lib/ordrin/errors.rb +147 -147
- data/lib/ordrin/normalize.rb +186 -186
- data/lib/ordrin/order.rb +79 -79
- data/lib/ordrin/ordrinapi.rb +66 -66
- data/lib/ordrin/restaurant.rb +56 -56
- data/lib/ordrin/user.rb +142 -142
- data/lib/ordrin.rb +58 -58
- metadata +5 -4
data/lib/ordrin/data.rb
CHANGED
@@ -1,148 +1,148 @@
|
|
1
|
-
require 'digest'
|
2
|
-
require_relative 'normalize'
|
3
|
-
module Ordrin
|
4
|
-
module Data
|
5
|
-
# Base class for objects that can save any data with the constructor and then
|
6
|
-
# extract it as a dictionary
|
7
|
-
class OrdrinData
|
8
|
-
# Return a dictionary of particular fields to values, determined per subclass
|
9
|
-
def make_dict
|
10
|
-
dict = {}
|
11
|
-
fields.map {|f| dict[f.to_s]=self.send(f) unless self.send(f).nil?}
|
12
|
-
return dict
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# Represents a street address
|
17
|
-
class Address < OrdrinData
|
18
|
-
|
19
|
-
attr_reader :addr, :city, :state, :zip, :phone, :addr2, :fields
|
20
|
-
|
21
|
-
# Store the parts of the address as fields in this object.
|
22
|
-
# Arguments:
|
23
|
-
# addr -- Street address
|
24
|
-
# city -- City
|
25
|
-
# state -- State
|
26
|
-
# zip -- Zip code
|
27
|
-
# phone -- Phone number
|
28
|
-
# addr2 -- Optional second street address line
|
29
|
-
def initialize(addr, city, state, zip, phone, addr2='')
|
30
|
-
@fields = [:addr, :city, :state, :zip, :phone, :addr2]
|
31
|
-
@addr = addr
|
32
|
-
@city = city
|
33
|
-
@state = Normalize.normalize(state, :state)
|
34
|
-
@zip = Normalize.normalize(zip, :zip)
|
35
|
-
@phone = Normalize.normalize(phone, :phone)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Represents information about a credit card
|
40
|
-
class CreditCard < OrdrinData
|
41
|
-
|
42
|
-
attr_reader :expiry_month, :expiry_year, :number, :cvc, :type, :name, :bill_address, :fields
|
43
|
-
|
44
|
-
# Store the credit card info as fields in this object.
|
45
|
-
# Arguments:
|
46
|
-
# name -- The name (first and last) on the credit card
|
47
|
-
# expiry_month -- The month that the card expires (two digits)
|
48
|
-
# expiry_year -- The year that the card expires (four digits)
|
49
|
-
# bill_address -- The billing address. Should be an Ordrin::Data::Address object
|
50
|
-
# number -- The credit card number
|
51
|
-
# cvc -- The card verification number
|
52
|
-
def initialize(name, expiry_month, expiry_year, bill_address, number, cvc)
|
53
|
-
@fields = [:number, :cvc, :expiry_month, :expiry_year, :expiry,
|
54
|
-
:bill_addr, :bill_addr2, :bill_city, :bill_state, :bill_zip,
|
55
|
-
:phone, :name]
|
56
|
-
@expiry_month = Normalize.normalize(expiry_month, :month)
|
57
|
-
@expiry_year = Normalize.normalize(expiry_year, :year)
|
58
|
-
@number, @cvc, @type = Normalize.normalize([number, cvc], :credit_card)
|
59
|
-
@name = name
|
60
|
-
@bill_address = bill_address
|
61
|
-
end
|
62
|
-
|
63
|
-
def bill_addr
|
64
|
-
@bill_address.addr
|
65
|
-
end
|
66
|
-
|
67
|
-
def bill_addr2
|
68
|
-
@bill_address.addr2
|
69
|
-
end
|
70
|
-
|
71
|
-
def bill_city
|
72
|
-
@bill_address.city
|
73
|
-
end
|
74
|
-
|
75
|
-
def bill_state
|
76
|
-
@bill_address.state
|
77
|
-
end
|
78
|
-
|
79
|
-
def bill_zip
|
80
|
-
@bill_address.zip
|
81
|
-
end
|
82
|
-
|
83
|
-
def phone
|
84
|
-
@bill_address.phone
|
85
|
-
end
|
86
|
-
|
87
|
-
# A combination of the expiry_month and expiry_date
|
88
|
-
def expiry
|
89
|
-
"#{expiry_month}/#{expiry_year}"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
#Represents a user's login information
|
94
|
-
class UserLogin < OrdrinData
|
95
|
-
|
96
|
-
attr_reader :email, :password, :fields
|
97
|
-
|
98
|
-
# Store the email and password in this object. Saves only the hash of the
|
99
|
-
# password, not the password itself
|
100
|
-
# Arguments:
|
101
|
-
# email -- The user's email address
|
102
|
-
# password -- The user's password (in plain text)
|
103
|
-
def initialize(email, password)
|
104
|
-
@fields = [:email, :password]
|
105
|
-
@email = email
|
106
|
-
@password = UserLogin.hash_password(password)
|
107
|
-
end
|
108
|
-
|
109
|
-
def UserLogin.hash_password(password)
|
110
|
-
return Digest::SHA256.new.hexdigest(password)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# Represents a single item in an order
|
115
|
-
class TrayItem
|
116
|
-
|
117
|
-
# Store the descriptors of an order item in this object.
|
118
|
-
# Arguments:
|
119
|
-
# item_id -- the restaurants's numerial ID for the item
|
120
|
-
# quantity -- the quantity
|
121
|
-
# options -- any number of options to apply to the item
|
122
|
-
def initialize(item_id, quantity, *options)
|
123
|
-
@item_id = Normalize.normalize(item_id, :number)
|
124
|
-
@quantity = Normalize.normalize(quantity, :number)
|
125
|
-
@options = options.map {|opt| Normalize.normalize(opt, :number)}
|
126
|
-
end
|
127
|
-
|
128
|
-
def to_s
|
129
|
-
"#{@item_id}/#{@quantity},#{@options*','}"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# Represents a list of items in an order
|
134
|
-
class Tray
|
135
|
-
|
136
|
-
# Store the list of items in this object. Each argument should be of type Item
|
137
|
-
# Arguments:
|
138
|
-
# items -- A list of items to be ordered in this tray
|
139
|
-
def initialize(*items)
|
140
|
-
@items = items
|
141
|
-
end
|
142
|
-
|
143
|
-
def to_s
|
144
|
-
return @items*'+'
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
1
|
+
require 'digest'
|
2
|
+
require_relative 'normalize'
|
3
|
+
module Ordrin
|
4
|
+
module Data
|
5
|
+
# Base class for objects that can save any data with the constructor and then
|
6
|
+
# extract it as a dictionary
|
7
|
+
class OrdrinData
|
8
|
+
# Return a dictionary of particular fields to values, determined per subclass
|
9
|
+
def make_dict
|
10
|
+
dict = {}
|
11
|
+
fields.map {|f| dict[f.to_s]=self.send(f) unless self.send(f).nil?}
|
12
|
+
return dict
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Represents a street address
|
17
|
+
class Address < OrdrinData
|
18
|
+
|
19
|
+
attr_reader :addr, :city, :state, :zip, :phone, :addr2, :fields
|
20
|
+
|
21
|
+
# Store the parts of the address as fields in this object.
|
22
|
+
# Arguments:
|
23
|
+
# addr -- Street address
|
24
|
+
# city -- City
|
25
|
+
# state -- State
|
26
|
+
# zip -- Zip code
|
27
|
+
# phone -- Phone number
|
28
|
+
# addr2 -- Optional second street address line
|
29
|
+
def initialize(addr, city, state, zip, phone, addr2='')
|
30
|
+
@fields = [:addr, :city, :state, :zip, :phone, :addr2]
|
31
|
+
@addr = addr
|
32
|
+
@city = city
|
33
|
+
@state = Normalize.normalize(state, :state)
|
34
|
+
@zip = Normalize.normalize(zip, :zip)
|
35
|
+
@phone = Normalize.normalize(phone, :phone)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Represents information about a credit card
|
40
|
+
class CreditCard < OrdrinData
|
41
|
+
|
42
|
+
attr_reader :expiry_month, :expiry_year, :number, :cvc, :type, :name, :bill_address, :fields
|
43
|
+
|
44
|
+
# Store the credit card info as fields in this object.
|
45
|
+
# Arguments:
|
46
|
+
# name -- The name (first and last) on the credit card
|
47
|
+
# expiry_month -- The month that the card expires (two digits)
|
48
|
+
# expiry_year -- The year that the card expires (four digits)
|
49
|
+
# bill_address -- The billing address. Should be an Ordrin::Data::Address object
|
50
|
+
# number -- The credit card number
|
51
|
+
# cvc -- The card verification number
|
52
|
+
def initialize(name, expiry_month, expiry_year, bill_address, number, cvc)
|
53
|
+
@fields = [:number, :cvc, :expiry_month, :expiry_year, :expiry,
|
54
|
+
:bill_addr, :bill_addr2, :bill_city, :bill_state, :bill_zip,
|
55
|
+
:phone, :name]
|
56
|
+
@expiry_month = Normalize.normalize(expiry_month, :month)
|
57
|
+
@expiry_year = Normalize.normalize(expiry_year, :year)
|
58
|
+
@number, @cvc, @type = Normalize.normalize([number, cvc], :credit_card)
|
59
|
+
@name = name
|
60
|
+
@bill_address = bill_address
|
61
|
+
end
|
62
|
+
|
63
|
+
def bill_addr
|
64
|
+
@bill_address.addr
|
65
|
+
end
|
66
|
+
|
67
|
+
def bill_addr2
|
68
|
+
@bill_address.addr2
|
69
|
+
end
|
70
|
+
|
71
|
+
def bill_city
|
72
|
+
@bill_address.city
|
73
|
+
end
|
74
|
+
|
75
|
+
def bill_state
|
76
|
+
@bill_address.state
|
77
|
+
end
|
78
|
+
|
79
|
+
def bill_zip
|
80
|
+
@bill_address.zip
|
81
|
+
end
|
82
|
+
|
83
|
+
def phone
|
84
|
+
@bill_address.phone
|
85
|
+
end
|
86
|
+
|
87
|
+
# A combination of the expiry_month and expiry_date
|
88
|
+
def expiry
|
89
|
+
"#{expiry_month}/#{expiry_year}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
#Represents a user's login information
|
94
|
+
class UserLogin < OrdrinData
|
95
|
+
|
96
|
+
attr_reader :email, :password, :fields
|
97
|
+
|
98
|
+
# Store the email and password in this object. Saves only the hash of the
|
99
|
+
# password, not the password itself
|
100
|
+
# Arguments:
|
101
|
+
# email -- The user's email address
|
102
|
+
# password -- The user's password (in plain text)
|
103
|
+
def initialize(email, password)
|
104
|
+
@fields = [:email, :password]
|
105
|
+
@email = email
|
106
|
+
@password = UserLogin.hash_password(password)
|
107
|
+
end
|
108
|
+
|
109
|
+
def UserLogin.hash_password(password)
|
110
|
+
return Digest::SHA256.new.hexdigest(password)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Represents a single item in an order
|
115
|
+
class TrayItem
|
116
|
+
|
117
|
+
# Store the descriptors of an order item in this object.
|
118
|
+
# Arguments:
|
119
|
+
# item_id -- the restaurants's numerial ID for the item
|
120
|
+
# quantity -- the quantity
|
121
|
+
# options -- any number of options to apply to the item
|
122
|
+
def initialize(item_id, quantity, *options)
|
123
|
+
@item_id = Normalize.normalize(item_id, :number)
|
124
|
+
@quantity = Normalize.normalize(quantity, :number)
|
125
|
+
@options = options.map {|opt| Normalize.normalize(opt, :number)}
|
126
|
+
end
|
127
|
+
|
128
|
+
def to_s
|
129
|
+
"#{@item_id}/#{@quantity},#{@options*','}"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Represents a list of items in an order
|
134
|
+
class Tray
|
135
|
+
|
136
|
+
# Store the list of items in this object. Each argument should be of type Item
|
137
|
+
# Arguments:
|
138
|
+
# items -- A list of items to be ordered in this tray
|
139
|
+
def initialize(*items)
|
140
|
+
@items = items
|
141
|
+
end
|
142
|
+
|
143
|
+
def to_s
|
144
|
+
return @items*'+'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
data/lib/ordrin/errors.rb
CHANGED
@@ -1,147 +1,147 @@
|
|
1
|
-
module Ordrin
|
2
|
-
module Errors
|
3
|
-
# This is the base class for errors specific to this ordrin package
|
4
|
-
class OrdrinError < Exception
|
5
|
-
attr_reader :msg
|
6
|
-
|
7
|
-
def initialize(msg=nil)
|
8
|
-
@msg = msg
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# This error encapsulates an API error returned by the server.
|
13
|
-
class ApiError < OrdrinError
|
14
|
-
attr_reader :text
|
15
|
-
def initialize(msg=nil, text=nil)
|
16
|
-
super(msg)
|
17
|
-
@text = text
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_s
|
21
|
-
"ApiError(msg='#{msg}', text='#{text}')"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# This error indicates that the server returned a response that could not be
|
26
|
-
# parsed into JSON
|
27
|
-
class ApiInvalidResponseError < OrdrinError
|
28
|
-
def to_s
|
29
|
-
"ApiInvalidResponseError(msg='#{msg}')"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def Errors.state
|
34
|
-
lambda do |value|
|
35
|
-
ArgumentError.new("State must be a two letter postal code abbreviation: #{value}")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def Errors.money
|
40
|
-
lambda do |value|
|
41
|
-
ArgumentError.new("Money must be dollars.cents: #{value}")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def Errors.zip
|
46
|
-
lambda do |value|
|
47
|
-
ArgumentError.new("Zip code must be exactly 5 digits: #{value}")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def Errors.phone
|
52
|
-
lambda do |value|
|
53
|
-
ArgumentError.new("Phone numbers must have exactly 10 digits: #{value}")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def Errors.number
|
58
|
-
lambda do |value|
|
59
|
-
ArgumentError.new("This value must be only digits: #{value}")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def Errors.month
|
64
|
-
lambda do |value|
|
65
|
-
ArgumentError.new("Months must be two digits: #{value}")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def Errors.year
|
70
|
-
lambda do |value|
|
71
|
-
ArgumentError.new("Years must be four digits: #{value}")
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def Errors.cvc
|
76
|
-
lambda do |value|
|
77
|
-
ArgumentError.new("Credit card CVC must be 3 or 4 digits, depending on the card type: #{value}")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def Errors.credit_card
|
82
|
-
lambda do |value|
|
83
|
-
ArgumentError.new("Credit card number must be a valid AmEx, Discover, Mastercard, or Visa card number: #{value}")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def Errors.email
|
88
|
-
lambda do |value|
|
89
|
-
ArgumentError.new("Bad email format: #{value}")
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def Errors.normalizer
|
94
|
-
lambda do |value|
|
95
|
-
ArgumentError.new("Unknown validator name: #{value}")
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def Errors.nick
|
100
|
-
lambda do |value|
|
101
|
-
ArgumentError.new("Nick names can only have letters, nubmers, dashes, and underscores: #{value}")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def Errors.date_time
|
106
|
-
lambda do |value|
|
107
|
-
ArgumentError.new("date_time must be a datetime.datetime object or the string 'ASAP': #{value}")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def Errors.date
|
112
|
-
lambda do |value|
|
113
|
-
ArgumentError.new("date must be a datetime.datetime or datetime.date object or the string 'ASAP': #{value}")
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def Errors.time
|
118
|
-
lambda do |value|
|
119
|
-
ArgumentError.new("time must be a datetime.datetime or datetime.time object: #{value}")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def Errors.url
|
124
|
-
lambda do |value|
|
125
|
-
ArgumentError.new("url must be a proper url: #{value}")
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def Errors.method
|
130
|
-
lambda do |value|
|
131
|
-
ArgumentError.new("method must be a word: #{value}")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def Errors.alphanum
|
136
|
-
lambda do |value|
|
137
|
-
ArgumentError.new("This value must be alphanumeric: #{value}")
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def Errors.request_method
|
142
|
-
lambda do |value|
|
143
|
-
ApiError.new("Method not a valid HTTP request method: #{value}")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
1
|
+
module Ordrin
|
2
|
+
module Errors
|
3
|
+
# This is the base class for errors specific to this ordrin package
|
4
|
+
class OrdrinError < Exception
|
5
|
+
attr_reader :msg
|
6
|
+
|
7
|
+
def initialize(msg=nil)
|
8
|
+
@msg = msg
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# This error encapsulates an API error returned by the server.
|
13
|
+
class ApiError < OrdrinError
|
14
|
+
attr_reader :text
|
15
|
+
def initialize(msg=nil, text=nil)
|
16
|
+
super(msg)
|
17
|
+
@text = text
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"ApiError(msg='#{msg}', text='#{text}')"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# This error indicates that the server returned a response that could not be
|
26
|
+
# parsed into JSON
|
27
|
+
class ApiInvalidResponseError < OrdrinError
|
28
|
+
def to_s
|
29
|
+
"ApiInvalidResponseError(msg='#{msg}')"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def Errors.state
|
34
|
+
lambda do |value|
|
35
|
+
ArgumentError.new("State must be a two letter postal code abbreviation: #{value}")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def Errors.money
|
40
|
+
lambda do |value|
|
41
|
+
ArgumentError.new("Money must be dollars.cents: #{value}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def Errors.zip
|
46
|
+
lambda do |value|
|
47
|
+
ArgumentError.new("Zip code must be exactly 5 digits: #{value}")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def Errors.phone
|
52
|
+
lambda do |value|
|
53
|
+
ArgumentError.new("Phone numbers must have exactly 10 digits: #{value}")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def Errors.number
|
58
|
+
lambda do |value|
|
59
|
+
ArgumentError.new("This value must be only digits: #{value}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def Errors.month
|
64
|
+
lambda do |value|
|
65
|
+
ArgumentError.new("Months must be two digits: #{value}")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def Errors.year
|
70
|
+
lambda do |value|
|
71
|
+
ArgumentError.new("Years must be four digits: #{value}")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def Errors.cvc
|
76
|
+
lambda do |value|
|
77
|
+
ArgumentError.new("Credit card CVC must be 3 or 4 digits, depending on the card type: #{value}")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def Errors.credit_card
|
82
|
+
lambda do |value|
|
83
|
+
ArgumentError.new("Credit card number must be a valid AmEx, Discover, Mastercard, or Visa card number: #{value}")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def Errors.email
|
88
|
+
lambda do |value|
|
89
|
+
ArgumentError.new("Bad email format: #{value}")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def Errors.normalizer
|
94
|
+
lambda do |value|
|
95
|
+
ArgumentError.new("Unknown validator name: #{value}")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def Errors.nick
|
100
|
+
lambda do |value|
|
101
|
+
ArgumentError.new("Nick names can only have letters, nubmers, dashes, and underscores: #{value}")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def Errors.date_time
|
106
|
+
lambda do |value|
|
107
|
+
ArgumentError.new("date_time must be a datetime.datetime object or the string 'ASAP': #{value}")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def Errors.date
|
112
|
+
lambda do |value|
|
113
|
+
ArgumentError.new("date must be a datetime.datetime or datetime.date object or the string 'ASAP': #{value}")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def Errors.time
|
118
|
+
lambda do |value|
|
119
|
+
ArgumentError.new("time must be a datetime.datetime or datetime.time object: #{value}")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def Errors.url
|
124
|
+
lambda do |value|
|
125
|
+
ArgumentError.new("url must be a proper url: #{value}")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def Errors.method
|
130
|
+
lambda do |value|
|
131
|
+
ArgumentError.new("method must be a word: #{value}")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def Errors.alphanum
|
136
|
+
lambda do |value|
|
137
|
+
ArgumentError.new("This value must be alphanumeric: #{value}")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def Errors.request_method
|
142
|
+
lambda do |value|
|
143
|
+
ApiError.new("Method not a valid HTTP request method: #{value}")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|