levelup 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/.rubocop.yml +427 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +58 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +113 -0
- data/Rakefile +1 -0
- data/levelup.gemspec +32 -0
- data/lib/levelup.rb +55 -0
- data/lib/levelup/api.rb +102 -0
- data/lib/levelup/configuration.rb +23 -0
- data/lib/levelup/endpoints/access_tokens.rb +40 -0
- data/lib/levelup/endpoints/app_users.rb +30 -0
- data/lib/levelup/endpoints/apps.rb +30 -0
- data/lib/levelup/endpoints/base.rb +25 -0
- data/lib/levelup/endpoints/credit_cards.rb +26 -0
- data/lib/levelup/endpoints/location_orders.rb +32 -0
- data/lib/levelup/endpoints/merchant_funded_credits.rb +19 -0
- data/lib/levelup/endpoints/merchant_locations.rb +32 -0
- data/lib/levelup/endpoints/merchant_orders.rb +28 -0
- data/lib/levelup/endpoints/orders.rb +19 -0
- data/lib/levelup/endpoints/permissions_requests.rb +28 -0
- data/lib/levelup/endpoints/qr_codes.rb +28 -0
- data/lib/levelup/endpoints/specific_location.rb +24 -0
- data/lib/levelup/endpoints/specific_merchant.rb +28 -0
- data/lib/levelup/endpoints/specific_order.rb +28 -0
- data/lib/levelup/endpoints/specific_permissions_request.rb +26 -0
- data/lib/levelup/endpoints/user_addresses.rb +25 -0
- data/lib/levelup/endpoints/user_orders.rb +18 -0
- data/lib/levelup/endpoints/users.rb +16 -0
- data/lib/levelup/errors/invalid_request.rb +8 -0
- data/lib/levelup/errors/unauthenticated.rb +8 -0
- data/lib/levelup/requests/authenticate_app.rb +19 -0
- data/lib/levelup/requests/authenticate_merchant.rb +26 -0
- data/lib/levelup/requests/base.rb +87 -0
- data/lib/levelup/requests/create_address.rb +19 -0
- data/lib/levelup/requests/create_card.rb +21 -0
- data/lib/levelup/requests/create_order.rb +33 -0
- data/lib/levelup/requests/create_user.rb +34 -0
- data/lib/levelup/requests/get_order.rb +17 -0
- data/lib/levelup/requests/get_qr_code.rb +16 -0
- data/lib/levelup/requests/get_user.rb +17 -0
- data/lib/levelup/requests/give_merchant_credit.rb +23 -0
- data/lib/levelup/requests/list_addresses.rb +20 -0
- data/lib/levelup/requests/list_locations.rb +24 -0
- data/lib/levelup/requests/list_orders.rb +23 -0
- data/lib/levelup/requests/list_user_orders.rb +20 -0
- data/lib/levelup/requests/refund_order.rb +21 -0
- data/lib/levelup/requests/request_permissions.rb +27 -0
- data/lib/levelup/requests/show_permissions_request.rb +21 -0
- data/lib/levelup/responses/error.rb +36 -0
- data/lib/levelup/responses/success.rb +11 -0
- data/lib/levelup/templates/data_parcel.rb +41 -0
- data/lib/levelup/templates/merchant_and_user_authenticated.rb +21 -0
- data/lib/levelup/templates/merchant_authenticated.rb +19 -0
- data/lib/levelup/templates/user_address_data.rb +20 -0
- data/lib/levelup/templates/user_authenticated.rb +17 -0
- data/spec/data_objects/requests/authenticate_app_spec.rb +13 -0
- data/spec/data_objects/requests/authenticate_merchant_spec.rb +14 -0
- data/spec/data_objects/requests/create_order_spec.rb +14 -0
- data/spec/data_objects/requests/get_order_spec.rb +13 -0
- data/spec/data_objects/requests/list_locations_spec.rb +13 -0
- data/spec/data_objects/requests/list_orders_spec.rb +13 -0
- data/spec/data_objects/requests/refund_order_spec.rb +19 -0
- data/spec/data_objects/requests/request_permissions_spec.rb +21 -0
- data/spec/data_objects/responses/error_spec.rb +67 -0
- data/spec/data_objects/responses/response_spec.rb +13 -0
- data/spec/endpoints/access_tokens_spec.rb +81 -0
- data/spec/endpoints/app_users_spec.rb +43 -0
- data/spec/endpoints/location_orders_spec.rb +34 -0
- data/spec/endpoints/merchant_funded_credits_spec.rb +16 -0
- data/spec/endpoints/merchant_locations_spec.rb +35 -0
- data/spec/endpoints/orders_spec.rb +37 -0
- data/spec/endpoints/permissions_requests_spec.rb +22 -0
- data/spec/endpoints/qr_codes_spec.rb +12 -0
- data/spec/endpoints/specific_order_spec.rb +33 -0
- data/spec/endpoints/specific_permissions_request_spec.rb +24 -0
- data/spec/endpoints/user_addresses_spec.rb +41 -0
- data/spec/endpoints/user_orders_spec.rb +12 -0
- data/spec/fixtures/keys.yml.example +15 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/vcr_filter_sensitive_data.rb +53 -0
- metadata +281 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
FILTERED_REQUEST_BODY_KEYS = {
|
4
|
+
'api_key' => '<APIKEY>',
|
5
|
+
'app_access_token' => '<APPTOKEN>',
|
6
|
+
'client_secret' => '<CLIENTSECRET>',
|
7
|
+
'merchant_access_token' => '<MERCHANTTOKEN>',
|
8
|
+
'password' => '<PASSWORD>'
|
9
|
+
}
|
10
|
+
|
11
|
+
FILTERED_REQUEST_HEADERS = {
|
12
|
+
'Authorization' => '<ACCESSTOKENS>'
|
13
|
+
}
|
14
|
+
|
15
|
+
FILTERED_RESPONSE_BODY_KEYS = {
|
16
|
+
'token' => '<ACCESSTOKEN>'
|
17
|
+
}
|
18
|
+
|
19
|
+
FILTERED_RESPONSE_HEADERS = {
|
20
|
+
'Set-Cookie' => '<SESSION>'
|
21
|
+
}
|
22
|
+
|
23
|
+
VCR.configure do |config|
|
24
|
+
FILTERED_REQUEST_BODY_KEYS.each do |key, replacement|
|
25
|
+
config.filter_sensitive_data(replacement) do |interaction|
|
26
|
+
regex = /"#{key}":\s*"(.*?)"/
|
27
|
+
matches = regex.match(interaction.request.body)
|
28
|
+
matches && matches[1]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
FILTERED_REQUEST_HEADERS.each do |header, replacement|
|
33
|
+
config.filter_sensitive_data(replacement) do |interaction|
|
34
|
+
header_val = interaction.request.headers[header]
|
35
|
+
header_val && header_val.first
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
FILTERED_RESPONSE_BODY_KEYS.each do |key, replacement|
|
40
|
+
config.filter_sensitive_data(replacement) do |interaction|
|
41
|
+
regex = /"#{key}":\s*"(.*?)"/
|
42
|
+
matches = regex.match(interaction.response.body)
|
43
|
+
matches && matches[1]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
FILTERED_RESPONSE_HEADERS.each do |header, replacement|
|
48
|
+
config.filter_sensitive_data(replacement) do |interaction|
|
49
|
+
header_val = interaction.response.headers[header]
|
50
|
+
header_val && header_val.first
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,281 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: levelup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- LevelUp POS Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 10.3.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 10.3.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-mocks
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.6
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.6
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.16.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.16.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: settingslogic
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.9
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.9
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.9.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.9.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.17.4
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.17.4
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: httparty
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.13.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.13.1
|
139
|
+
description: |-
|
140
|
+
A tool to simplify, streamline, and quickly
|
141
|
+
communicate with the LevelUp REST API, allowing for companies to easily
|
142
|
+
implement the ability to pay with LevelUp on their e-commerce platforms.
|
143
|
+
email:
|
144
|
+
- pos-support@thelevelup.com
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rubocop.yml"
|
151
|
+
- Gemfile
|
152
|
+
- Gemfile.lock
|
153
|
+
- LICENSE
|
154
|
+
- LICENSE.txt
|
155
|
+
- README.md
|
156
|
+
- Rakefile
|
157
|
+
- levelup.gemspec
|
158
|
+
- lib/levelup.rb
|
159
|
+
- lib/levelup/api.rb
|
160
|
+
- lib/levelup/configuration.rb
|
161
|
+
- lib/levelup/endpoints/access_tokens.rb
|
162
|
+
- lib/levelup/endpoints/app_users.rb
|
163
|
+
- lib/levelup/endpoints/apps.rb
|
164
|
+
- lib/levelup/endpoints/base.rb
|
165
|
+
- lib/levelup/endpoints/credit_cards.rb
|
166
|
+
- lib/levelup/endpoints/location_orders.rb
|
167
|
+
- lib/levelup/endpoints/merchant_funded_credits.rb
|
168
|
+
- lib/levelup/endpoints/merchant_locations.rb
|
169
|
+
- lib/levelup/endpoints/merchant_orders.rb
|
170
|
+
- lib/levelup/endpoints/orders.rb
|
171
|
+
- lib/levelup/endpoints/permissions_requests.rb
|
172
|
+
- lib/levelup/endpoints/qr_codes.rb
|
173
|
+
- lib/levelup/endpoints/specific_location.rb
|
174
|
+
- lib/levelup/endpoints/specific_merchant.rb
|
175
|
+
- lib/levelup/endpoints/specific_order.rb
|
176
|
+
- lib/levelup/endpoints/specific_permissions_request.rb
|
177
|
+
- lib/levelup/endpoints/user_addresses.rb
|
178
|
+
- lib/levelup/endpoints/user_orders.rb
|
179
|
+
- lib/levelup/endpoints/users.rb
|
180
|
+
- lib/levelup/errors/invalid_request.rb
|
181
|
+
- lib/levelup/errors/unauthenticated.rb
|
182
|
+
- lib/levelup/requests/authenticate_app.rb
|
183
|
+
- lib/levelup/requests/authenticate_merchant.rb
|
184
|
+
- lib/levelup/requests/base.rb
|
185
|
+
- lib/levelup/requests/create_address.rb
|
186
|
+
- lib/levelup/requests/create_card.rb
|
187
|
+
- lib/levelup/requests/create_order.rb
|
188
|
+
- lib/levelup/requests/create_user.rb
|
189
|
+
- lib/levelup/requests/get_order.rb
|
190
|
+
- lib/levelup/requests/get_qr_code.rb
|
191
|
+
- lib/levelup/requests/get_user.rb
|
192
|
+
- lib/levelup/requests/give_merchant_credit.rb
|
193
|
+
- lib/levelup/requests/list_addresses.rb
|
194
|
+
- lib/levelup/requests/list_locations.rb
|
195
|
+
- lib/levelup/requests/list_orders.rb
|
196
|
+
- lib/levelup/requests/list_user_orders.rb
|
197
|
+
- lib/levelup/requests/refund_order.rb
|
198
|
+
- lib/levelup/requests/request_permissions.rb
|
199
|
+
- lib/levelup/requests/show_permissions_request.rb
|
200
|
+
- lib/levelup/responses/error.rb
|
201
|
+
- lib/levelup/responses/success.rb
|
202
|
+
- lib/levelup/templates/data_parcel.rb
|
203
|
+
- lib/levelup/templates/merchant_and_user_authenticated.rb
|
204
|
+
- lib/levelup/templates/merchant_authenticated.rb
|
205
|
+
- lib/levelup/templates/user_address_data.rb
|
206
|
+
- lib/levelup/templates/user_authenticated.rb
|
207
|
+
- spec/data_objects/requests/authenticate_app_spec.rb
|
208
|
+
- spec/data_objects/requests/authenticate_merchant_spec.rb
|
209
|
+
- spec/data_objects/requests/create_order_spec.rb
|
210
|
+
- spec/data_objects/requests/get_order_spec.rb
|
211
|
+
- spec/data_objects/requests/list_locations_spec.rb
|
212
|
+
- spec/data_objects/requests/list_orders_spec.rb
|
213
|
+
- spec/data_objects/requests/refund_order_spec.rb
|
214
|
+
- spec/data_objects/requests/request_permissions_spec.rb
|
215
|
+
- spec/data_objects/responses/error_spec.rb
|
216
|
+
- spec/data_objects/responses/response_spec.rb
|
217
|
+
- spec/endpoints/access_tokens_spec.rb
|
218
|
+
- spec/endpoints/app_users_spec.rb
|
219
|
+
- spec/endpoints/location_orders_spec.rb
|
220
|
+
- spec/endpoints/merchant_funded_credits_spec.rb
|
221
|
+
- spec/endpoints/merchant_locations_spec.rb
|
222
|
+
- spec/endpoints/orders_spec.rb
|
223
|
+
- spec/endpoints/permissions_requests_spec.rb
|
224
|
+
- spec/endpoints/qr_codes_spec.rb
|
225
|
+
- spec/endpoints/specific_order_spec.rb
|
226
|
+
- spec/endpoints/specific_permissions_request_spec.rb
|
227
|
+
- spec/endpoints/user_addresses_spec.rb
|
228
|
+
- spec/endpoints/user_orders_spec.rb
|
229
|
+
- spec/fixtures/keys.yml.example
|
230
|
+
- spec/spec_helper.rb
|
231
|
+
- spec/support/vcr_filter_sensitive_data.rb
|
232
|
+
homepage: http://developer.thelevelup.com
|
233
|
+
licenses:
|
234
|
+
- MIT
|
235
|
+
metadata: {}
|
236
|
+
post_install_message:
|
237
|
+
rdoc_options: []
|
238
|
+
require_paths:
|
239
|
+
- lib
|
240
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '0'
|
245
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
requirements: []
|
251
|
+
rubyforge_project:
|
252
|
+
rubygems_version: 2.3.0
|
253
|
+
signing_key:
|
254
|
+
specification_version: 4
|
255
|
+
summary: A Ruby client for communicating with the LevelUp API
|
256
|
+
test_files:
|
257
|
+
- spec/data_objects/requests/authenticate_app_spec.rb
|
258
|
+
- spec/data_objects/requests/authenticate_merchant_spec.rb
|
259
|
+
- spec/data_objects/requests/create_order_spec.rb
|
260
|
+
- spec/data_objects/requests/get_order_spec.rb
|
261
|
+
- spec/data_objects/requests/list_locations_spec.rb
|
262
|
+
- spec/data_objects/requests/list_orders_spec.rb
|
263
|
+
- spec/data_objects/requests/refund_order_spec.rb
|
264
|
+
- spec/data_objects/requests/request_permissions_spec.rb
|
265
|
+
- spec/data_objects/responses/error_spec.rb
|
266
|
+
- spec/data_objects/responses/response_spec.rb
|
267
|
+
- spec/endpoints/access_tokens_spec.rb
|
268
|
+
- spec/endpoints/app_users_spec.rb
|
269
|
+
- spec/endpoints/location_orders_spec.rb
|
270
|
+
- spec/endpoints/merchant_funded_credits_spec.rb
|
271
|
+
- spec/endpoints/merchant_locations_spec.rb
|
272
|
+
- spec/endpoints/orders_spec.rb
|
273
|
+
- spec/endpoints/permissions_requests_spec.rb
|
274
|
+
- spec/endpoints/qr_codes_spec.rb
|
275
|
+
- spec/endpoints/specific_order_spec.rb
|
276
|
+
- spec/endpoints/specific_permissions_request_spec.rb
|
277
|
+
- spec/endpoints/user_addresses_spec.rb
|
278
|
+
- spec/endpoints/user_orders_spec.rb
|
279
|
+
- spec/fixtures/keys.yml.example
|
280
|
+
- spec/spec_helper.rb
|
281
|
+
- spec/support/vcr_filter_sensitive_data.rb
|