lime_light_platform 1.0.0.12 → 1.0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +3 -6
- data/lib/lime_light_platform/app_base.rb +16 -2
- data/lib/lime_light_platform.rb +227 -84
- data/lime_light_platform-1.0.0.12.gem +0 -0
- data/lime_light_platform-1.0.0.13.gem +0 -0
- data/lime_light_platform.gemspec +1 -1
- data/spec/billing_model_view_spec.rb +7 -7
- data/spec/campaign_find_active_spec.rb +7 -7
- data/spec/campaign_view_spec.rb +7 -7
- data/spec/gateway_view_spec.rb +7 -7
- data/spec/new_order_spec.rb +33 -31
- data/spec/offer_view_spec.rb +8 -8
- data/spec/order_find_spec.rb +83 -0
- data/spec/order_find_updated_spec.rb +65 -0
- data/spec/order_force_bill_spec.rb +21 -0
- data/spec/order_reprocess_spec.rb +17 -0
- data/spec/order_update_recurring_spec.rb +20 -0
- data/spec/order_update_spec.rb +108 -0
- data/spec/order_view_spec.rb +22 -0
- data/spec/product_create_spec.rb +10 -9
- data/spec/product_update_spec.rb +14 -10
- data/spec/validate_credentials_spec.rb +17 -0
- metadata +11 -6
- data/lime_light_platform-1.0.0.10.gem +0 -0
- data/lime_light_platform-1.0.0.11.gem +0 -0
- data/lime_light_platform-1.0.0.7.gem +0 -0
- data/lime_light_platform-1.0.0.8.gem +0 -0
- data/lime_light_platform-1.0.0.9.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04e75d5944c843fa91ebde76c6e6c2257f929c71f1e5b394c6ac81afbf7dcd5
|
4
|
+
data.tar.gz: fb40c35e54d0a17476a98a5c1122f640e0c5c06ce804581c1be4b1cb5e43ec18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59b210afd6881eb4aaf69810f137a8083e2c479f4926ee18df5d8b6222ec5fc3f0c65c51bac1fc18623e6cd3a32ea679ad9e42a0989cc5bf4730352e0d593f72
|
7
|
+
data.tar.gz: bc27d88cc2a628288d9cbaf0df3f038fcc85a4af6ff226b9c9daee8e201adb712c0302d8d6acd40d0fed420f6da06989d08f9248d5c8e7fb664ea4377123206b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
lime_light_platform (1.0.0.12)
|
5
|
-
|
6
1
|
GEM
|
7
2
|
remote: https://rubygems.org/
|
8
3
|
specs:
|
@@ -34,6 +29,8 @@ GEM
|
|
34
29
|
dotenv (= 2.4.0)
|
35
30
|
railties (>= 3.2, < 6.0)
|
36
31
|
erubi (1.7.1)
|
32
|
+
faker (1.8.7)
|
33
|
+
i18n (>= 0.7)
|
37
34
|
i18n (1.0.1)
|
38
35
|
concurrent-ruby (~> 1.0)
|
39
36
|
loofah (2.2.2)
|
@@ -84,7 +81,7 @@ DEPENDENCIES
|
|
84
81
|
activesupport
|
85
82
|
awesome_print
|
86
83
|
dotenv-rails
|
87
|
-
|
84
|
+
faker
|
88
85
|
rspec
|
89
86
|
|
90
87
|
BUNDLED WITH
|
@@ -14,6 +14,12 @@ class AppBase
|
|
14
14
|
BODY_F_RAW = 'RAW'
|
15
15
|
BODY_F_NONE = 'NO_BODY'
|
16
16
|
|
17
|
+
attr_accessor :debug
|
18
|
+
|
19
|
+
def initialize debug=false
|
20
|
+
@debug = debug
|
21
|
+
end
|
22
|
+
|
17
23
|
def perform_api_call call_params
|
18
24
|
valid = true
|
19
25
|
response_body = ''
|
@@ -56,10 +62,18 @@ class AppBase
|
|
56
62
|
api_request.body = ''
|
57
63
|
end
|
58
64
|
|
59
|
-
|
60
|
-
|
65
|
+
if @debug
|
66
|
+
ap "API Request =>"
|
67
|
+
ap api_request.body
|
68
|
+
end
|
69
|
+
|
61
70
|
api_response = http.request api_request
|
62
71
|
response_body = api_response.body
|
72
|
+
|
73
|
+
if @debug
|
74
|
+
ap "API Response =>"
|
75
|
+
ap response_body
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
response_body
|
data/lib/lime_light_platform.rb
CHANGED
@@ -14,7 +14,9 @@ class LimeLightPlatform < AppBase
|
|
14
14
|
:api_password,
|
15
15
|
:dev_subdirectory
|
16
16
|
|
17
|
-
def initialize app_key, api_username, api_password, dev_subdirectory=''
|
17
|
+
def initialize app_key, api_username, api_password, dev_subdirectory='', debug=false
|
18
|
+
super debug
|
19
|
+
|
18
20
|
if app_key.blank?
|
19
21
|
raise ApiError.new 'App Key is required'
|
20
22
|
end
|
@@ -37,6 +39,12 @@ class LimeLightPlatform < AppBase
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
42
|
+
def billing_model_view offer_id
|
43
|
+
call_params = base_call_params __method__
|
44
|
+
call_params[:body]['offer_id'] = offer_id
|
45
|
+
common_perform_post call_params
|
46
|
+
end
|
47
|
+
|
40
48
|
def campaign_find_active
|
41
49
|
response = default_response
|
42
50
|
api_response = perform_api_call base_call_params(__method__)
|
@@ -48,17 +56,14 @@ class LimeLightPlatform < AppBase
|
|
48
56
|
response[:code] = response_code
|
49
57
|
campaigns = []
|
50
58
|
|
51
|
-
if response_code == 100
|
59
|
+
if response_code == 100 && key_exists('campaigns', parsed)
|
52
60
|
response[:success] = true
|
53
|
-
|
54
|
-
campaign_names = parsed['campaign_name']
|
55
|
-
|
56
|
-
campaign_ids.each_with_index {|campaign_id, i|
|
61
|
+
parsed['campaigns'].each do |key, payload|
|
57
62
|
campaigns << {
|
58
|
-
'id' => campaign_id,
|
59
|
-
'name' =>
|
63
|
+
'id' => payload['campaign_id'],
|
64
|
+
'name' => payload['campaign_name']
|
60
65
|
}
|
61
|
-
|
66
|
+
end
|
62
67
|
end
|
63
68
|
|
64
69
|
response[:data] = campaigns
|
@@ -120,6 +125,147 @@ class LimeLightPlatform < AppBase
|
|
120
125
|
common_perform_post call_params
|
121
126
|
end
|
122
127
|
|
128
|
+
def offer_view campaign_id
|
129
|
+
call_params = base_call_params __method__
|
130
|
+
call_params[:body]['campaign_id'] = campaign_id
|
131
|
+
common_perform_post call_params
|
132
|
+
end
|
133
|
+
|
134
|
+
def order_find request={}
|
135
|
+
call_params = base_call_params __method__
|
136
|
+
date_times = default_date_times
|
137
|
+
call_params[:body] = {
|
138
|
+
'campaign_id' => get_if_exists('campaign_id', request, 'all'),
|
139
|
+
'start_date' => get_if_exists('start_date', request, date_times[:today]),
|
140
|
+
'end_date' => get_if_exists('end_date', request, date_times[:today]),
|
141
|
+
'start_time' => get_if_exists('start_time', request, date_times[:start_time]),
|
142
|
+
'end_time' => get_if_exists('end_time', request, date_times[:end_time]),
|
143
|
+
'search_type' => get_if_exists('search_type', request, 'any'), # could be all
|
144
|
+
'return_type' => 'order_view' # always order_view
|
145
|
+
}
|
146
|
+
|
147
|
+
if key_exists('product_ids', request)
|
148
|
+
call_params[:body]['product_ids'] = request['product_ids']
|
149
|
+
end
|
150
|
+
|
151
|
+
if key_exists('member_token', request)
|
152
|
+
call_params[:body]['member_token'] = request['member_token']
|
153
|
+
end
|
154
|
+
|
155
|
+
if key_exists('criteria', request)
|
156
|
+
call_params[:body]['criteria'] = request['criteria']
|
157
|
+
end
|
158
|
+
|
159
|
+
common_perform_post call_params
|
160
|
+
end
|
161
|
+
|
162
|
+
def order_find_updated request={}
|
163
|
+
call_params = base_call_params __method__
|
164
|
+
date_times = default_date_times
|
165
|
+
call_params[:body] = {
|
166
|
+
'campaign_id' => get_if_exists('campaign_id', request),
|
167
|
+
'start_date' => get_if_exists('start_date', request, date_times[:today]),
|
168
|
+
'end_date' => get_if_exists('end_date', request, date_times[:today]),
|
169
|
+
'start_time' => get_if_exists('start_time', request, date_times[:start_time]),
|
170
|
+
'end_time' => get_if_exists('end_time', request, date_times[:end_time]),
|
171
|
+
'group_keys' => get_if_exists('group_keys', request)
|
172
|
+
}
|
173
|
+
common_perform_post call_params
|
174
|
+
end
|
175
|
+
|
176
|
+
def order_force_bill request={}
|
177
|
+
call_params = base_call_params __method__
|
178
|
+
call_params[:body] = {
|
179
|
+
'order_id' => get_if_exists('order_id', request)
|
180
|
+
}
|
181
|
+
|
182
|
+
if key_exists('force_gateway_id', request)
|
183
|
+
call_params[:body]['forceGatewayId'] = request['force_gateway_id']
|
184
|
+
end
|
185
|
+
|
186
|
+
if key_exists('preserve_force_gateway', request)
|
187
|
+
call_params[:body]['preserve_force_gateway'] = request['preserve_force_gateway']
|
188
|
+
end
|
189
|
+
|
190
|
+
common_perform_post call_params
|
191
|
+
end
|
192
|
+
|
193
|
+
def order_reprocess order_id
|
194
|
+
call_params = base_call_params __method__
|
195
|
+
call_params[:body] = { 'order_id' => order_id }
|
196
|
+
common_perform_post call_params
|
197
|
+
end
|
198
|
+
|
199
|
+
def order_update_recurring request={}
|
200
|
+
call_params = base_call_params __method__
|
201
|
+
call_params[:body] = {
|
202
|
+
'order_id' => get_if_exists('order_id', request, 0),
|
203
|
+
'status' => get_if_exists('status', request)
|
204
|
+
}
|
205
|
+
common_perform_post call_params
|
206
|
+
end
|
207
|
+
|
208
|
+
def order_update request={}
|
209
|
+
call_params = base_call_params __method__
|
210
|
+
call_params[:body] = { 'sync_all' => get_if_exists('sync_all', request, 0) }
|
211
|
+
update_options = [
|
212
|
+
'confirmation_status',
|
213
|
+
'blacklist',
|
214
|
+
'fraud',
|
215
|
+
'chargeback',
|
216
|
+
'notes',
|
217
|
+
'first_name',
|
218
|
+
'last_name',
|
219
|
+
'email',
|
220
|
+
'phone',
|
221
|
+
'shipping_method',
|
222
|
+
'shipping_address1',
|
223
|
+
'shipping_address2',
|
224
|
+
'shipping_city',
|
225
|
+
'shipping_zip',
|
226
|
+
'shipping_state',
|
227
|
+
'shipping_country',
|
228
|
+
'billing_address1',
|
229
|
+
'billing_address2',
|
230
|
+
'billing_city',
|
231
|
+
'billing_zip',
|
232
|
+
'billing_state',
|
233
|
+
'billing_country',
|
234
|
+
'rebill_discount',
|
235
|
+
'next_rebill_product',
|
236
|
+
'cc_number',
|
237
|
+
'check_routing',
|
238
|
+
'check_account',
|
239
|
+
'check_ssn',
|
240
|
+
'cc_expiration_date',
|
241
|
+
'cc_payment_type',
|
242
|
+
'recurring_date',
|
243
|
+
'stop_recurring_next_success',
|
244
|
+
'rma',
|
245
|
+
'return',
|
246
|
+
'tracking_number',
|
247
|
+
'payment_received',
|
248
|
+
'subscription_override',
|
249
|
+
'afid',
|
250
|
+
'affid',
|
251
|
+
'aid',
|
252
|
+
'sid',
|
253
|
+
'c1',
|
254
|
+
'c2',
|
255
|
+
'c3',
|
256
|
+
'opt'
|
257
|
+
]
|
258
|
+
common_update_perform_post call_params, request, 'order_id', update_options
|
259
|
+
end
|
260
|
+
|
261
|
+
def order_view request={}
|
262
|
+
call_params = base_call_params __method__
|
263
|
+
call_params[:body] = {
|
264
|
+
'order_id' => get_if_exists('order_id', request, [])
|
265
|
+
}
|
266
|
+
common_perform_post call_params
|
267
|
+
end
|
268
|
+
|
123
269
|
def product_create request={}
|
124
270
|
call_params = base_call_params __method__
|
125
271
|
call_params[:body] = {
|
@@ -148,72 +294,30 @@ class LimeLightPlatform < AppBase
|
|
148
294
|
end
|
149
295
|
|
150
296
|
def product_update request={}
|
151
|
-
response = default_response
|
152
297
|
call_params = base_call_params __method__
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
'product_max_quantity'
|
177
|
-
]
|
178
|
-
|
179
|
-
# only update what is present
|
180
|
-
keys.each do |key|
|
181
|
-
if key_exists(key, request)
|
182
|
-
if !key_exists(request['product_id'].to_s, call_params[:body]['product_id'])
|
183
|
-
call_params[:body]['product_id'][request['product_id'].to_s] = {}
|
184
|
-
end
|
185
|
-
|
186
|
-
call_params[:body]['product_id'][request['product_id'].to_s][key] = get_by_key(key, request)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
if !call_params[:body]['product_id'].empty?
|
191
|
-
api_response = perform_api_call call_params
|
192
|
-
response[:raw] = api_response
|
193
|
-
|
194
|
-
if !api_response.nil?
|
195
|
-
parsed = JSON.parse(api_response)
|
196
|
-
response_code = get_response_code(parsed)
|
197
|
-
|
198
|
-
if !response_code.blank?
|
199
|
-
response_code = response_code.to_i
|
200
|
-
response[:code] = response_code
|
201
|
-
|
202
|
-
if response_code == 100
|
203
|
-
response[:success] = true
|
204
|
-
response[:data] = parsed
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
response
|
212
|
-
end
|
213
|
-
|
214
|
-
def order_update
|
215
|
-
response = default_response
|
216
|
-
response
|
298
|
+
update_options = [
|
299
|
+
'customer_purchase_limit',
|
300
|
+
'taxable',
|
301
|
+
'shippable',
|
302
|
+
'signature_confirmation',
|
303
|
+
'delivery_confirmation',
|
304
|
+
'preserve_quantity',
|
305
|
+
'collections',
|
306
|
+
'shipping_declared_value',
|
307
|
+
'product_price',
|
308
|
+
'product_restocking_fee',
|
309
|
+
'shipping_weight',
|
310
|
+
'product_sku',
|
311
|
+
'shipping_digital_url',
|
312
|
+
'recurring_discount_max',
|
313
|
+
'product_name',
|
314
|
+
'product_description',
|
315
|
+
'category_id',
|
316
|
+
'vertical_id',
|
317
|
+
'cost_of_goods_sold',
|
318
|
+
'product_max_quantity'
|
319
|
+
]
|
320
|
+
common_update_perform_post call_params, request, 'product_id', update_options
|
217
321
|
end
|
218
322
|
|
219
323
|
def subscription_order_update
|
@@ -221,16 +325,8 @@ class LimeLightPlatform < AppBase
|
|
221
325
|
response
|
222
326
|
end
|
223
327
|
|
224
|
-
def
|
225
|
-
|
226
|
-
call_params[:body]['offer_id'] = offer_id
|
227
|
-
common_perform_post call_params
|
228
|
-
end
|
229
|
-
|
230
|
-
def offer_view campaign_id
|
231
|
-
call_params = base_call_params __method__
|
232
|
-
call_params[:body]['campaign_id'] = campaign_id
|
233
|
-
common_perform_post call_params
|
328
|
+
def validate_credentials
|
329
|
+
common_perform_post(base_call_params(__method__))
|
234
330
|
end
|
235
331
|
|
236
332
|
private
|
@@ -278,4 +374,51 @@ class LimeLightPlatform < AppBase
|
|
278
374
|
|
279
375
|
response
|
280
376
|
end
|
377
|
+
|
378
|
+
# used for "only if there" updates
|
379
|
+
def common_update_perform_post call_params, request, record_key, update_options=[]
|
380
|
+
response = default_response
|
381
|
+
|
382
|
+
# only update what is present
|
383
|
+
if key_exists(record_key, request)
|
384
|
+
call_params[:body][record_key] = {}
|
385
|
+
|
386
|
+
request[record_key].each {|id, payload|
|
387
|
+
str_id = id.to_s
|
388
|
+
call_params[:body][record_key][str_id] = {}
|
389
|
+
|
390
|
+
update_options.each do |option|
|
391
|
+
if key_exists(option, payload)
|
392
|
+
call_params[:body][record_key][str_id][option] = payload[option]
|
393
|
+
end
|
394
|
+
end
|
395
|
+
}
|
396
|
+
|
397
|
+
if !call_params[:body][record_key].empty?
|
398
|
+
api_response = perform_api_call call_params
|
399
|
+
response[:raw] = api_response
|
400
|
+
|
401
|
+
if !api_response.nil?
|
402
|
+
parsed = JSON.parse(api_response)
|
403
|
+
response_code = get_response_code(parsed)
|
404
|
+
|
405
|
+
if !response_code.blank?
|
406
|
+
response_code = response_code.to_i
|
407
|
+
response[:code] = response_code
|
408
|
+
|
409
|
+
if response_code == 100
|
410
|
+
response[:success] = true
|
411
|
+
response[:data] = parsed
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
response
|
419
|
+
end
|
420
|
+
|
421
|
+
def default_date_times
|
422
|
+
{ today: Time.now.strftime('%m/%d/%Y'), start_time: '00:00:00', end_time: '23:59:59' }
|
423
|
+
end
|
281
424
|
end
|
Binary file
|
Binary file
|
data/lime_light_platform.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'lime_light_platform'
|
3
|
-
s.version = '1.0.0.
|
3
|
+
s.version = '1.0.0.14'
|
4
4
|
s.date = '2018-05-07'
|
5
5
|
s.summary = "Official Lime Light eCommerce Platform API Ruby Gem (In Development)"
|
6
6
|
s.description = "Official Lime Light eCommerce Platform API Ruby Gem (In Development)"
|
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe LimeLightPlatform, "#billing_model_view" do
|
4
4
|
context "Lime Light Platform - Membership API - billing_model_view" do
|
5
5
|
it "Returns all the data for a given set of billing model(s)" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
7
13
|
response = lime_light.billing_model_view ENV['TEST_OFFER_ID_1']
|
8
|
-
|
9
|
-
if !response[:success]
|
10
|
-
ap 'TEST FAILED - API RESPONSE'
|
11
|
-
ap response
|
12
|
-
end
|
13
|
-
|
14
14
|
expect(response[:success]).to eq true
|
15
15
|
end
|
16
16
|
end
|
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe LimeLightPlatform, "#campaign_find_active" do
|
4
4
|
context "Lime Light Platform - Membership API - campaign_find_active" do
|
5
5
|
it "Returns all active campaigns for the CRM instance" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
7
13
|
response = lime_light.campaign_find_active
|
8
|
-
|
9
|
-
if !response[:success]
|
10
|
-
ap 'TEST FAILED - API RESPONSE'
|
11
|
-
ap response
|
12
|
-
end
|
13
|
-
|
14
14
|
expect(response[:success]).to eq true
|
15
15
|
end
|
16
16
|
end
|
data/spec/campaign_view_spec.rb
CHANGED
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe LimeLightPlatform, "#campaign_view" do
|
4
4
|
context "Lime Light Platform - Membership API - campaign_view" do
|
5
5
|
it "Returns data that describes a given campaign" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
7
13
|
response = lime_light.campaign_view ENV['TEST_CAMPAIGNID']
|
8
|
-
|
9
|
-
if !response[:success]
|
10
|
-
ap 'TEST FAILED - API RESPONSE'
|
11
|
-
ap response
|
12
|
-
end
|
13
|
-
|
14
14
|
expect(response[:success]).to eq true
|
15
15
|
end
|
16
16
|
end
|
data/spec/gateway_view_spec.rb
CHANGED
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe LimeLightPlatform, "#gateway_view" do
|
4
4
|
context "Lime Light Platform - Membership API - gateway_view" do
|
5
5
|
it "Returns data that describes a given gateway" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
7
13
|
response = lime_light.gateway_view ENV['TEST_GATEWAY_ID_2']
|
8
|
-
|
9
|
-
if !response[:success]
|
10
|
-
ap 'TEST FAILED - API RESPONSE'
|
11
|
-
ap response
|
12
|
-
end
|
13
|
-
|
14
14
|
expect(response[:success]).to eq true
|
15
15
|
end
|
16
16
|
end
|
data/spec/new_order_spec.rb
CHANGED
@@ -1,28 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'faker'
|
3
|
+
Faker::Config.locale = 'en-US'
|
2
4
|
|
3
|
-
RSpec.describe LimeLightPlatform, "#
|
5
|
+
RSpec.describe LimeLightPlatform, "#NewOrder" do
|
4
6
|
context "Lime Light Platform - Transaction API - NewOrder" do
|
5
7
|
it "Places a new order using billing model configuration" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
8
|
+
lime_light = LimeLightPlatform.new(
|
9
|
+
ENV['APP_KEY'],
|
10
|
+
ENV['API_USERNAME'],
|
11
|
+
ENV['API_PASSWORD'],
|
12
|
+
ENV['DEV_SUB'],
|
13
|
+
true
|
14
|
+
)
|
7
15
|
response = lime_light.new_order({
|
8
|
-
'first_name' =>
|
9
|
-
'last_name' =>
|
10
|
-
'shipping_address_1' =>
|
11
|
-
'shipping_address_2' =>
|
12
|
-
'shipping_city' =>
|
13
|
-
'shipping_state' =>
|
14
|
-
'shipping_zip' =>
|
16
|
+
'first_name' => Faker::Name.first_name,
|
17
|
+
'last_name' => Faker::Name.last_name,
|
18
|
+
'shipping_address_1' => Faker::Address.street_address,
|
19
|
+
'shipping_address_2' => Faker::Address.secondary_address,
|
20
|
+
'shipping_city' => Faker::Address.city,
|
21
|
+
'shipping_state' => Faker::Address.state_abbr,
|
22
|
+
'shipping_zip' => Faker::Address.postcode,
|
15
23
|
'shipping_country' => ENV['TEST_SHIPPINGCOUNTRY'],
|
16
|
-
'billing_first_name' =>
|
17
|
-
'billing_last_name' =>
|
18
|
-
'billing_address_1' =>
|
19
|
-
'billing_address_2' =>
|
20
|
-
'billing_city' =>
|
21
|
-
'billing_state' =>
|
22
|
-
'billing_zip' =>
|
24
|
+
'billing_first_name' => Faker::Name.first_name,
|
25
|
+
'billing_last_name' => Faker::Name.last_name,
|
26
|
+
'billing_address_1' => Faker::Address.street_address,
|
27
|
+
'billing_address_2' => Faker::Address.secondary_address,
|
28
|
+
'billing_city' => Faker::Address.city,
|
29
|
+
'billing_state' => Faker::Address.state_abbr,
|
30
|
+
'billing_zip' => Faker::Address.postcode,
|
23
31
|
'billing_country' => ENV['TEST_BILLINGCOUNTRY'],
|
24
|
-
'phone' =>
|
25
|
-
'email' =>
|
32
|
+
'phone' => Faker::PhoneNumber.phone_number,
|
33
|
+
'email' => Faker::Internet.email,
|
26
34
|
'credit_card_type' => ENV['TEST_CREDITCARDTYPE'],
|
27
35
|
'credit_card_number' => ENV['TEST_CREDITCARDNUMBER'],
|
28
36
|
'expiration_date' => ENV['TEST_EXPIRATIONDATE'],
|
@@ -31,12 +39,12 @@ RSpec.describe LimeLightPlatform, "#campaign_find_active" do
|
|
31
39
|
'tran_type' => ENV['TEST_TRANTYPE'],
|
32
40
|
'ip_address' => ENV['TEST_IPADDRESS'],
|
33
41
|
'campaign_id' => ENV['TEST_CAMPAIGNID'],
|
34
|
-
'notes' =>
|
35
|
-
'utm_source' =>
|
36
|
-
'utm_medium' =>
|
37
|
-
'utm_campaign' =>
|
38
|
-
'utm_content' =>
|
39
|
-
'utm_term' =>
|
42
|
+
'notes' => Faker::FamilyGuy.quote,
|
43
|
+
'utm_source' => Faker::FamilyGuy.quote,
|
44
|
+
'utm_medium' => Faker::FamilyGuy.quote,
|
45
|
+
'utm_campaign' => Faker::FamilyGuy.quote,
|
46
|
+
'utm_content' => Faker::FamilyGuy.quote,
|
47
|
+
'utm_term' => Faker::FamilyGuy.quote,
|
40
48
|
'products' => {
|
41
49
|
ENV['TEST_PRODUCT_1'] => {
|
42
50
|
'offer_id' => ENV['TEST_OFFER_ID_1'],
|
@@ -46,16 +54,10 @@ RSpec.describe LimeLightPlatform, "#campaign_find_active" do
|
|
46
54
|
ENV['TEST_PRODUCT_2'] => {
|
47
55
|
'offer_id' => ENV['TEST_OFFER_ID_2'],
|
48
56
|
'billing_model_id' => ENV['TEST_BILLING_MODEL_ID_2'],
|
49
|
-
'quantity' => ENV['
|
57
|
+
'quantity' => ENV['TEST_QUANTITY_2']
|
50
58
|
}
|
51
59
|
}
|
52
60
|
})
|
53
|
-
|
54
|
-
if !response[:success]
|
55
|
-
ap 'TEST FAILED - API RESPONSE'
|
56
|
-
ap response
|
57
|
-
end
|
58
|
-
|
59
61
|
expect(response[:success]).to eq true
|
60
62
|
end
|
61
63
|
end
|
data/spec/offer_view_spec.rb
CHANGED
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe LimeLightPlatform, "#offer_view" do
|
4
4
|
context "Lime Light Platform - Membersip API - offer_view" do
|
5
5
|
it "Returns offer data for a given campaign" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
13
|
+
response = lime_light.offer_view ENV['TEST_OFFER_VIEW_CAMPAIGN_ID']
|
14
14
|
expect(response[:success]).to eq true
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_find" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_find" do
|
5
|
+
it "Finds an order based upon criteria" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
13
|
+
status_options = [
|
14
|
+
ENV['TEST_ORDER_FIND_ALL'],
|
15
|
+
ENV['TEST_ORDER_FIND_DECLINES'],
|
16
|
+
ENV['TEST_ORDER_FIND_SUCCESS'],
|
17
|
+
ENV['TEST_ORDER_FIND_NEW'],
|
18
|
+
ENV['TEST_ORDER_FIND_APPROVED'],
|
19
|
+
ENV['TEST_ORDER_FIND_PENDING'],
|
20
|
+
ENV['TEST_ORDER_FIND_HOLD'],
|
21
|
+
ENV['TEST_ORDER_FIND_RECURRING'],
|
22
|
+
ENV['TEST_ORDER_FIND_FRAUD'],
|
23
|
+
ENV['TEST_ORDER_FIND_ARCHIVED'],
|
24
|
+
ENV['TEST_ORDER_FIND_CHARGEBACK'],
|
25
|
+
ENV['TEST_ORDER_FIND_VOID'],
|
26
|
+
ENV['TEST_ORDER_FIND_UNSHIPPED'],
|
27
|
+
ENV['TEST_ORDER_FIND_SHIPPED'],
|
28
|
+
ENV['TEST_ORDER_FIND_CONFIRMED'],
|
29
|
+
ENV['TEST_ORDER_FIND_NOT_CONFIRMED'],
|
30
|
+
ENV['TEST_ORDER_FIND_NO_CONFIRMATION_STATUS'],
|
31
|
+
ENV['TEST_ORDER_FIND_NO_UPSELLS'],
|
32
|
+
ENV['TEST_ORDER_FIND_HAS_UPSELLS'],
|
33
|
+
ENV['TEST_ORDER_FIND_FULL_REFUNDS'],
|
34
|
+
ENV['TEST_ORDER_FIND_PARTIAL_REFUNDS'],
|
35
|
+
ENV['TEST_ORDER_FIND_NO_PRESERVE_GATEWAY'],
|
36
|
+
ENV['TEST_ORDER_FIND_ALL_REFUNDS']
|
37
|
+
]
|
38
|
+
criteria_options = [
|
39
|
+
{'customer_id' => ENV['TEST_ORDER_FIND_CRITERIA_CUSTOMER_ID']},
|
40
|
+
{'category_id' => ENV['TEST_ORDER_FIND_CRITERIA_CUSTOMER_ID']},
|
41
|
+
{'customer_id' => ENV['TEST_ORDER_FIND_CRITERIA_CUSTOMER_ID']},
|
42
|
+
{'category_id' => ENV['TEST_ORDER_FIND_CRITERIA_CATEGORY_ID']},
|
43
|
+
{'first_6_cc' => ENV['TEST_ORDER_FIND_CRITERIA_FIRST_6_CC']},
|
44
|
+
{'last_4_cc' => ENV['TEST_ORDER_FIND_CRITERIA_LAST_4_CC']},
|
45
|
+
{'order_total' => ENV['TEST_ORDER_FIND_CRITERIA_ORDER_TOTAL']},
|
46
|
+
{'first_name' => ENV['TEST_ORDER_FIND_CRITERIA_FIRST_NAME']},
|
47
|
+
{'last_name' => ENV['TEST_ORDER_FIND_CRITERIA_LAST_NAME']},
|
48
|
+
{'billing_first_name' => ENV['TEST_ORDER_FIND_CRITERIA_BILLING_FIRST_NAME']},
|
49
|
+
{'billing_last_name' => ENV['TEST_ORDER_FIND_CRITERIA_BILLING_LAST_NAME']},
|
50
|
+
{'shipping_first_name' => ENV['TEST_ORDER_FIND_CRITERIA_SHIPPING_FIRST_NAME']},
|
51
|
+
{'shipping_last_name' => ENV['TEST_ORDER_FIND_CRITERIA_SHIPPING_LAST_NAME']},
|
52
|
+
{'address' => ENV['TEST_ORDER_FIND_ADDRESS']},
|
53
|
+
{'city' => ENV['TEST_ORDER_FIND_CITY']},
|
54
|
+
{'state' => ENV['TEST_ORDER_FIND_STATE']},
|
55
|
+
{'zip' => ENV['TEST_ORDER_FIND_ZIP']},
|
56
|
+
{'country' => ENV['TEST_ORDER_FIND_COUNTRY']},
|
57
|
+
{'phone' => ENV['TEST_ORDER_FIND_PHONE']},
|
58
|
+
{'email' => ENV['TEST_ORDER_FIND_EMAIL']},
|
59
|
+
{'ip_address' => ENV['TEST_ORDER_FIND_IP_ADDRESS']},
|
60
|
+
{'transaction_id' => ENV['TEST_ORDER_FIND_TRANSACTION_ID']},
|
61
|
+
{'affiliate_id' => ENV['TEST_ORDER_FIND_AFFILIATE_ID']},
|
62
|
+
{'sub_affiliate_id' => ENV['TEST_ORDER_FIND_SUB_AFFILIATE_ID']},
|
63
|
+
{'billing_cycle' => ENV['TEST_ORDER_FIND_BILLING_CYCLE']},
|
64
|
+
{'tracking_num' => ENV['TEST_ORDER_FIND_TRACKING_NUM']},
|
65
|
+
{'last_4_routing' => ENV['TEST_ORDER_FIND_LAST_4_ROUTING']},
|
66
|
+
{'last_4_account' => ENV['TEST_ORDER_FIND_LAST_4_ACCOUNT']},
|
67
|
+
{'last_4_ssn' => ENV['TEST_ORDER_FIND_LAST_4_SSN']},
|
68
|
+
{'order_total' => {"range" => ['50.00', '100.00']}},
|
69
|
+
{'status' => status_options.sample}
|
70
|
+
]
|
71
|
+
response = lime_light.order_find({
|
72
|
+
'campaign_id' => ENV['TEST_ORDER_FIND_CAMPAIGN_ID'],
|
73
|
+
'start_date' => ENV['TEST_ORDER_FIND_START_DATE'],
|
74
|
+
'end_date' => ENV['TEST_ORDER_FIND_END_DATE'],
|
75
|
+
'start_time' => ENV['TEST_ORDER_FIND_START_TIME'],
|
76
|
+
'end_time' => ENV['TEST_ORDER_FIND_END_TIME'],
|
77
|
+
'search_type' => ENV['TEST_ORDER_FIND_SEARCH_TYPE'],
|
78
|
+
'criteria' => criteria_options.sample
|
79
|
+
})
|
80
|
+
expect(response[:success]).to eq true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_find_updated" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_find_updated" do
|
5
|
+
it "Finds orders with updated statuses" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
true
|
12
|
+
)
|
13
|
+
group_key_options = [
|
14
|
+
[
|
15
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_BILLING_INFO'],
|
16
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_BLACKLIST'],
|
17
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_CHARGEBACK'],
|
18
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_CONFIRMATION'],
|
19
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_CREDIT_CARD_INFO']
|
20
|
+
],
|
21
|
+
[
|
22
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_EMAIL'],
|
23
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_FAILURES'],
|
24
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_FORCE_REBILL'],
|
25
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_FRAUD'],
|
26
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_NAME'],
|
27
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_NEXT_REBILL_PRODUCT']
|
28
|
+
],
|
29
|
+
[
|
30
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_NOTES'],
|
31
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_OFFLINE_PAYMENT'],
|
32
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_PHONE'],
|
33
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_REBILL_DISCOUNT'],
|
34
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RECURRING_DATE'],
|
35
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RECURRING_SCHEDULING'],
|
36
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RECURRING_STATUS']
|
37
|
+
],
|
38
|
+
[
|
39
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_REFUND'],
|
40
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_REPROCESS'],
|
41
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RESTORED'],
|
42
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RETURN'],
|
43
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_RMA'],
|
44
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_SHIPPING_INFO']
|
45
|
+
],
|
46
|
+
[
|
47
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_SHIPPING_METHOD'],
|
48
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_SHIPPING_STATUS'],
|
49
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_TRACKING_NUMBER'],
|
50
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_VOID'],
|
51
|
+
ENV['TEST_ORDER_FIND_UPDATED_GROUP_KEY_FULFILLMENT_POST']
|
52
|
+
]
|
53
|
+
]
|
54
|
+
response = lime_light.order_find_updated({
|
55
|
+
'campaign_id' => ENV['TEST_ORDER_FIND_UPDATED_CAMPAIGN_ID'],
|
56
|
+
'start_date' => ENV['TEST_ORDER_FIND_UPDATED_START_DATE'],
|
57
|
+
'end_date' => ENV['TEST_ORDER_FIND_UPDATED_END_DATE'],
|
58
|
+
'start_time' => ENV['TEST_ORDER_FIND_UPDATED_START_TIME'],
|
59
|
+
'end_time' => ENV['TEST_ORDER_FIND_UPDATED_END_TIME'],
|
60
|
+
'group_keys' => group_key_options.sample
|
61
|
+
})
|
62
|
+
expect(response[:success]).to eq true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_force_bill" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_force_bill" do
|
5
|
+
it "Force rebill an order" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
true
|
12
|
+
)
|
13
|
+
response = lime_light.order_force_bill({
|
14
|
+
'order_id' => ENV['TEST_ORDER_FORCE_BILL_ORDER_ID'],
|
15
|
+
'force_gateway_id' => ENV['TEST_ORDER_FORCE_BILL_GATEWAY_ID'],
|
16
|
+
'preserve_force_gateway' => ENV['TEST_ORDER_FORCE_BILL_PRESERVE_GATEWAY_ID']
|
17
|
+
})
|
18
|
+
expect(response[:success]).to eq true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_reprocess" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_reprocess" do
|
5
|
+
it "Reprocesses an order" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
13
|
+
response = lime_light.order_reprocess ENV['ORDER_REPROCESS_ORDER_ID']
|
14
|
+
expect(response[:success]).to eq true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_update_recurring" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_update_recurring" do
|
5
|
+
it "Updates the recurring status of an order" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
true
|
12
|
+
)
|
13
|
+
response = lime_light.order_update_recurring({
|
14
|
+
'order_id' => ENV['TEST_ORDER_UPDATE_RECURRING_ORDER'],
|
15
|
+
'status' => ENV['TEST_ORDER_UPDATE_RECURRING_STATUS']
|
16
|
+
})
|
17
|
+
expect(response[:success]).to eq true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'faker'
|
3
|
+
Faker::Config.locale = 'en-US'
|
4
|
+
|
5
|
+
RSpec.describe LimeLightPlatform, "#order_update" do
|
6
|
+
context "Lime Light Platform - Membersip API - order_update" do
|
7
|
+
it "Updates an order based upon criteria" do
|
8
|
+
lime_light = LimeLightPlatform.new(
|
9
|
+
ENV['APP_KEY'],
|
10
|
+
ENV['API_USERNAME'],
|
11
|
+
ENV['API_PASSWORD'],
|
12
|
+
ENV['DEV_SUB'],
|
13
|
+
true
|
14
|
+
)
|
15
|
+
options = [
|
16
|
+
{
|
17
|
+
'confirmation_status' => ENV['TEST_ORDER_UPDATE_CONFIRMATION_STATUS'],
|
18
|
+
'blacklist' => ENV['TEST_ORDER_UPDATE_BLACKLIST'],
|
19
|
+
'fraud' => ENV['TEST_ORDER_UPDATE_FRAUD'],
|
20
|
+
'chargeback' => ENV['TEST_ORDER_UPDATE_CHARGEBACK']
|
21
|
+
},
|
22
|
+
{
|
23
|
+
'notes' => Faker::RickAndMorty.quote,
|
24
|
+
'first_name' => Faker::Name.first_name,
|
25
|
+
'last_name' => Faker::Name.last_name,
|
26
|
+
'email' => Faker::Internet.email
|
27
|
+
},
|
28
|
+
{
|
29
|
+
'phone' => Faker::PhoneNumber.phone_number
|
30
|
+
},
|
31
|
+
{
|
32
|
+
'shipping_method' => ENV['TEST_ORDER_UPDATE_SHIPPING_METHOD'],
|
33
|
+
'shipping_address1' => Faker::Address.street_address,
|
34
|
+
'shipping_address2' => Faker::Address.secondary_address
|
35
|
+
},
|
36
|
+
{
|
37
|
+
'shipping_city' => Faker::Address.city,
|
38
|
+
'shipping_zip' => Faker::Address.postcode,
|
39
|
+
'shipping_state' => Faker::Address.state_abbr,
|
40
|
+
'shipping_country' => ENV['TEST_ORDER_UPDATE_SHIPPING_COUNTRY']
|
41
|
+
},
|
42
|
+
{
|
43
|
+
'billing_address1' => Faker::Address.street_address,
|
44
|
+
'billing_address2' => Faker::Address.secondary_address,
|
45
|
+
'billing_city' => Faker::Address.city
|
46
|
+
},
|
47
|
+
{
|
48
|
+
'billing_zip' => Faker::Address.postcode,
|
49
|
+
'billing_state' => Faker::Address.state_abbr,
|
50
|
+
'billing_country' => ENV['TEST_ORDER_UPDATE_BILLING_COUNTRY']
|
51
|
+
},
|
52
|
+
{
|
53
|
+
'rebill_discount' => ENV['TEST_ORDER_UPDATE_REBILL_DISCOUNT'],
|
54
|
+
'next_rebill_product' => ENV['TEST_ORDER_UPDATE_NEXT_REBILL_PRODUCT'],
|
55
|
+
'cc_number' => ENV['TEST_ORDER_UPDATE_CC_NUMBER']
|
56
|
+
},
|
57
|
+
{
|
58
|
+
'check_routing' => ENV['TEST_ORDER_UPDATE_CHECK_ROUTING'],
|
59
|
+
'check_account' => ENV['TEST_ORDER_UPDATE_CHECK_ACCOUNT'],
|
60
|
+
'check_ssn' => ENV['TEST_ORDER_UPDATE_CHECK_SSN']
|
61
|
+
},
|
62
|
+
{
|
63
|
+
'cc_expiration_date' => ENV['TEST_ORDER_UPDATE_CC_EXPIRATION_DATE'],
|
64
|
+
'cc_payment_type' => ENV['TEST_ORDER_UPDATE_CC_PAYMENT_TYPE']
|
65
|
+
},
|
66
|
+
{
|
67
|
+
'recurring_date' => ENV['TEST_ORDER_UPDATE_RECURRING_DATE']
|
68
|
+
},
|
69
|
+
{
|
70
|
+
'stop_recurring_next_success' => ENV['TEST_ORDER_UPDATE_STOP_RECURRING_NEXT_SUCCESS']
|
71
|
+
},
|
72
|
+
{
|
73
|
+
'rma' => ENV['TEST_ORDER_UPDATE_RMA'],
|
74
|
+
'return' => ENV['TEST_ORDER_UPDATE_RETURN']
|
75
|
+
},
|
76
|
+
{
|
77
|
+
'tracking_number' => ENV['TEST_ORDER_UPDATE_TRACKING_NUMBER'],
|
78
|
+
'payment_received' => ENV['TEST_ORDER_UPDATE_PAYMENT_RECEIVED'],
|
79
|
+
'subscription_override' => ENV['TEST_ORDER_UPDATE_SUBSCRIPTION_OVERRIDE']
|
80
|
+
},
|
81
|
+
{
|
82
|
+
'afid' => Faker::RickAndMorty.location,
|
83
|
+
'affid' => Faker::RickAndMorty.location,
|
84
|
+
'aid' => Faker::RickAndMorty.location
|
85
|
+
},
|
86
|
+
{
|
87
|
+
'sid' => Faker::RickAndMorty.location,
|
88
|
+
'c1' => Faker::RickAndMorty.location
|
89
|
+
},
|
90
|
+
{
|
91
|
+
'c2' => Faker::RickAndMorty.location,
|
92
|
+
'c3' => Faker::RickAndMorty.location,
|
93
|
+
'opt' => Faker::RickAndMorty.location
|
94
|
+
}
|
95
|
+
]
|
96
|
+
|
97
|
+
response = lime_light.order_update({
|
98
|
+
'sync_all' => ENV['TEST_ORDER_UPDATE_SYNC_ALL'],
|
99
|
+
'order_id' => {
|
100
|
+
ENV['TEST_ORDER_UPDATE_ORDER_ID_1'] => options.sample,
|
101
|
+
ENV['TEST_ORDER_UPDATE_ORDER_ID_2'] => options.sample,
|
102
|
+
ENV['TEST_ORDER_UPDATE_ORDER_ID_3'] => options.sample
|
103
|
+
}
|
104
|
+
})
|
105
|
+
expect(response[:success]).to eq true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#order_view" do
|
4
|
+
context "Lime Light Platform - Membersip API - order_view" do
|
5
|
+
it "View order details" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
true
|
12
|
+
)
|
13
|
+
response = lime_light.order_view({
|
14
|
+
'order_id' => [
|
15
|
+
ENV['ORDER_VIEW_ORDER_ID_1'],
|
16
|
+
ENV['ORDER_VIEW_ORDER_ID_2']
|
17
|
+
]
|
18
|
+
})
|
19
|
+
expect(response[:success]).to eq true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/product_create_spec.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'faker'
|
2
3
|
|
3
4
|
RSpec.describe LimeLightPlatform, "#product_create" do
|
4
5
|
context "Lime Light Platform - Membersip API - product_create" do
|
5
6
|
it "Creates a Lime Light Product" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
7
|
+
lime_light = LimeLightPlatform.new(
|
8
|
+
ENV['APP_KEY'],
|
9
|
+
ENV['API_USERNAME'],
|
10
|
+
ENV['API_PASSWORD'],
|
11
|
+
ENV['DEV_SUB'],
|
12
|
+
false
|
13
|
+
)
|
7
14
|
response = lime_light.product_create({
|
8
15
|
'customer_purchase_limit' => ENV['TEST_CUSTOMER_PURCHASE_LIMIT'],
|
9
16
|
'taxable' => ENV['TEST_TAXABLE'],
|
@@ -19,19 +26,13 @@ RSpec.describe LimeLightPlatform, "#product_create" do
|
|
19
26
|
'product_sku' => ENV['TEST_PRODUCT_SKU'] + Random.new.rand(10...1000).to_s,
|
20
27
|
'shipping_digital_url' => ENV['TEST_SHIPPING_DIGITAL_URL'],
|
21
28
|
'recurring_discount_max' => ENV['TEST_RECURRING_DISCOUNT_MAX'],
|
22
|
-
'product_name' =>
|
23
|
-
'product_description' =>
|
29
|
+
'product_name' => Faker::Pokemon.name,
|
30
|
+
'product_description' => Faker::RickAndMorty.quote,
|
24
31
|
'category_id' => ENV['TEST_CATEGORY_ID'],
|
25
32
|
'vertical_id' => ENV['TEST_VERTICAL_ID'],
|
26
33
|
'cost_of_goods_sold' => ENV['TEST_COST_OF_GOODS_SOLD'],
|
27
34
|
'product_max_quantity' => ENV['TEST_PRODUCT_MAX_QUANTITY']
|
28
35
|
})
|
29
|
-
|
30
|
-
if !response[:success]
|
31
|
-
ap 'TEST FAILED - API RESPONSE'
|
32
|
-
ap response
|
33
|
-
end
|
34
|
-
|
35
36
|
expect(response[:success]).to eq true
|
36
37
|
end
|
37
38
|
end
|
data/spec/product_update_spec.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'faker'
|
2
3
|
|
3
4
|
RSpec.describe LimeLightPlatform, "#product_update" do
|
4
5
|
context "Lime Light Platform - Membersip API - product_update" do
|
5
6
|
it "Updates a Lime Light Product" do
|
6
|
-
lime_light = LimeLightPlatform.new(
|
7
|
+
lime_light = LimeLightPlatform.new(
|
8
|
+
ENV['APP_KEY'],
|
9
|
+
ENV['API_USERNAME'],
|
10
|
+
ENV['API_PASSWORD'],
|
11
|
+
ENV['DEV_SUB'],
|
12
|
+
false
|
13
|
+
)
|
7
14
|
response = lime_light.product_update({
|
8
|
-
'product_id' =>
|
9
|
-
|
10
|
-
|
15
|
+
'product_id' => {
|
16
|
+
ENV['TEST_UPDATE_PRODUCT_ID'] => {
|
17
|
+
'product_name' => Faker::Pokemon.move,
|
18
|
+
'product_description' => Faker::RickAndMorty.quote
|
19
|
+
}
|
20
|
+
}
|
11
21
|
})
|
12
|
-
|
13
|
-
if !response[:success]
|
14
|
-
ap 'TEST FAILED - API RESPONSE'
|
15
|
-
ap response
|
16
|
-
end
|
17
|
-
|
18
22
|
expect(response[:success]).to eq true
|
19
23
|
end
|
20
24
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe LimeLightPlatform, "#validate_credentials" do
|
4
|
+
context "Lime Light Platform - Membersip API - validate_credentials" do
|
5
|
+
it "Validates the API username and password" do
|
6
|
+
lime_light = LimeLightPlatform.new(
|
7
|
+
ENV['APP_KEY'],
|
8
|
+
ENV['API_USERNAME'],
|
9
|
+
ENV['API_PASSWORD'],
|
10
|
+
ENV['DEV_SUB'],
|
11
|
+
false
|
12
|
+
)
|
13
|
+
response = lime_light.validate_credentials
|
14
|
+
expect(response[:success]).to eq true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lime_light_platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marvin Titus-Casseus
|
@@ -22,11 +22,8 @@ files:
|
|
22
22
|
- lib/lime_light_platform/api_error.rb
|
23
23
|
- lib/lime_light_platform/app_base.rb
|
24
24
|
- lib/lime_light_platform/helpers/accessor.rb
|
25
|
-
- lime_light_platform-1.0.0.
|
26
|
-
- lime_light_platform-1.0.0.
|
27
|
-
- lime_light_platform-1.0.0.7.gem
|
28
|
-
- lime_light_platform-1.0.0.8.gem
|
29
|
-
- lime_light_platform-1.0.0.9.gem
|
25
|
+
- lime_light_platform-1.0.0.12.gem
|
26
|
+
- lime_light_platform-1.0.0.13.gem
|
30
27
|
- lime_light_platform.gemspec
|
31
28
|
- spec/billing_model_view_spec.rb
|
32
29
|
- spec/campaign_find_active_spec.rb
|
@@ -34,9 +31,17 @@ files:
|
|
34
31
|
- spec/gateway_view_spec.rb
|
35
32
|
- spec/new_order_spec.rb
|
36
33
|
- spec/offer_view_spec.rb
|
34
|
+
- spec/order_find_spec.rb
|
35
|
+
- spec/order_find_updated_spec.rb
|
36
|
+
- spec/order_force_bill_spec.rb
|
37
|
+
- spec/order_reprocess_spec.rb
|
38
|
+
- spec/order_update_recurring_spec.rb
|
39
|
+
- spec/order_update_spec.rb
|
40
|
+
- spec/order_view_spec.rb
|
37
41
|
- spec/product_create_spec.rb
|
38
42
|
- spec/product_update_spec.rb
|
39
43
|
- spec/spec_helper.rb
|
44
|
+
- spec/validate_credentials_spec.rb
|
40
45
|
homepage: https://rubygems.org/gems/lime_light_platform
|
41
46
|
licenses:
|
42
47
|
- Lime Light CRM Inc
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|