lime_light_platform 1.0.0.17 → 1.0.0.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b680b1a30f58c4717cd3275dc8b475c056412f86e3b3294c0546901a3d96207a
4
- data.tar.gz: 2b61b89361918543dfb17f6d0b7df409e610d9b32fa803bbbeb45e175120ded2
3
+ metadata.gz: 5b390368b3a6891b9d338128b76ac534bf62ade8d537da6587403c4c36279664
4
+ data.tar.gz: a4ad66ec4dfeb2f61e7eb0f1df60c0995f4f7efd4a9bbbe6f2255464e39d2107
5
5
  SHA512:
6
- metadata.gz: 9a8953d8e94d6dec3a7897553f9b33103fab9a2bdaf247f6c7d2115a35954e8ed07b466d4e9c2f7120954381aba6a1596d4b9a9682612ba042000e0b5857d306
7
- data.tar.gz: c274fe64179362fcf30b102281053dd12b27a0b24d3e7a7fe8c765f330abe5ef8b7bf3b4e6e7e5f46f9232107216822bc548bf20c6e5ea6e0e2ff3df48aaa06a
6
+ metadata.gz: 3c788c89d45fe0fa20cf55901a158054d2d152203af3baeaff5cffd3115e5ae7c6893135cbfc00fd80933582e4eba157e552e2f147017227e53caff7e5878cb2
7
+ data.tar.gz: 33dc4d2d8411e0db57a6f9be4f172eb8c8b0c298920d69bbb1709c8886727be1b4ceac870c0cee93436ab10a236ed1a2f4043e69f1fa497082d9b571f4fa9351
@@ -4,6 +4,7 @@ require 'lime_light_platform/api_error'
4
4
  require 'lime_light_platform/app_base'
5
5
  require 'lime_light_platform/helpers/accessor'
6
6
 
7
+ # @author Lime Light CRM Engineers
7
8
  class LimeLightPlatform < AppBase
8
9
  include Helpers::Accessor
9
10
 
@@ -14,6 +15,11 @@ class LimeLightPlatform < AppBase
14
15
  :api_password,
15
16
  :dev_subdirectory
16
17
 
18
+ # @param app_key [String] The CRM app key
19
+ # @param api_username [String] The CRM app key
20
+ # @param api_password [String] The CRM app key
21
+ # @param dev_subdirectory [String] Subdirectory for developer environments
22
+ # @param debug [Boolean] Increses the log level of API requests and responses
17
23
  def initialize app_key, api_username, api_password, dev_subdirectory='', debug=false
18
24
  super debug
19
25
 
@@ -39,10 +45,13 @@ class LimeLightPlatform < AppBase
39
45
  end
40
46
  end
41
47
 
48
+ # Retrieve billing model data for a specified billing model ID
49
+ # @param request [Hash] Request payload hash
42
50
  def billing_model_view request={}
43
51
  common_optional_param_perform_post base_call_params(__method__), ['offer_id', 'billing_model_id'], request
44
52
  end
45
53
 
54
+ # Return all active campaigns ina CRM instance
46
55
  def campaign_find_active
47
56
  response = default_response
48
57
  api_response = perform_api_call base_call_params(__method__)
@@ -70,18 +79,57 @@ class LimeLightPlatform < AppBase
70
79
  response
71
80
  end
72
81
 
82
+ # Retrieve campaign data for a specified campaign ID
83
+ # @param campaign_id [Integer] Campaign ID from CRM instance
73
84
  def campaign_view campaign_id
74
85
  common_entity_view_perform_post base_call_params(__method__), 'campaign_id', campaign_id
75
86
  end
76
87
 
88
+ # Validate a coupon based on promo code and other coupon parameters
89
+ # @param request [Hash] Request payload hash
90
+ def coupon_validate request={}
91
+ call_params = base_call_params __method__
92
+ call_params[:body] = {
93
+ 'campaign_id' => get_if_exists('campaign_id', request, 0),
94
+ 'shipping_id' => get_if_exists('shipping_id', request, 0),
95
+ 'email' => get_if_exists('email', request),
96
+ 'promo_code' => get_if_exists('promo_code', request),
97
+ 'products' => get_if_exists('products', request)
98
+ }
99
+ common_perform_post call_params
100
+ end
101
+
102
+ # Retrieve customer data for a specified customer ID
103
+ # @param customer_id [Integer] Customer ID from CRM instance
77
104
  def customer_view customer_id
78
105
  common_entity_view_perform_post base_call_params(__method__), 'customer_id', customer_id
79
106
  end
80
107
 
108
+ # Retrieve gateway data for a specified gateway ID
109
+ # @param gateway_id [Integer] Gateway ID from CRM instance
81
110
  def gateway_view gateway_id
82
111
  common_entity_view_perform_post base_call_params(__method__), 'gateway_id', gateway_id
83
112
  end
84
113
 
114
+ # Retrieve alternative provider parameters (paypal, icepay)
115
+ # @param request [Hash] Request payload hash
116
+ def get_alternative_provider request={}
117
+ call_params = base_call_params __method__
118
+ call_params[:body] = {
119
+ 'campaign_id' => get_if_exists('campaign_id', request, 0),
120
+ 'alt_pay_type' => get_if_exists('alt_pay_type', request),
121
+ 'return_url' => get_if_exists('return_url', request),
122
+ 'cancel_url' => get_if_exists('cancel_url', request),
123
+ 'amount' => get_if_exists('amount', request),
124
+ 'shipping_id' => get_if_exists('shipping_id', request),
125
+ 'bill_country' => get_if_exists('bill_country', request), # icepay only
126
+ 'products' => get_if_exists('products', request)
127
+ }
128
+ common_perform_post call_params
129
+ end
130
+
131
+ # Create and process a new order
132
+ # @param request [Hash] Request payload hash
85
133
  def new_order request={}
86
134
  method_name = __method__.to_s
87
135
  call_params = base_call_params method_name.camelize
@@ -123,10 +171,14 @@ class LimeLightPlatform < AppBase
123
171
  common_perform_post call_params
124
172
  end
125
173
 
174
+ # Retrieve offer data according to offer ID and/or campaign ID
175
+ # @param request [Hash] Request payload hash
126
176
  def offer_view request={}
127
177
  common_optional_param_perform_post base_call_params(__method__), ['offer_id', 'campaign_id'], request
128
178
  end
129
179
 
180
+ # Search for one or more order records according to criteria
181
+ # @param request [Hash] Request payload hash
130
182
  def order_find request={}
131
183
  call_params = base_call_params __method__
132
184
  date_times = default_date_times
@@ -155,6 +207,9 @@ class LimeLightPlatform < AppBase
155
207
  common_perform_post call_params
156
208
  end
157
209
 
210
+ # Search for one or more order records according to criteria
211
+ # Criteria is based on several updated statuses
212
+ # @param request [Hash] Request payload hash
158
213
  def order_find_updated request={}
159
214
  call_params = base_call_params __method__
160
215
  date_times = default_date_times
@@ -169,6 +224,7 @@ class LimeLightPlatform < AppBase
169
224
  common_perform_post call_params
170
225
  end
171
226
 
227
+ # @param request [Hash] Request payload hash
172
228
  def order_force_bill request={}
173
229
  call_params = base_call_params __method__
174
230
  call_params[:body] = {
@@ -186,12 +242,16 @@ class LimeLightPlatform < AppBase
186
242
  common_perform_post call_params
187
243
  end
188
244
 
245
+ # Reprocess a declined order
246
+ # @param order_id [Integer] The order ID from CRM instance
189
247
  def order_reprocess order_id
190
248
  call_params = base_call_params __method__
191
249
  call_params[:body] = { 'order_id' => order_id }
192
250
  common_perform_post call_params
193
251
  end
194
252
 
253
+ # Update the recurring properties of an order on an active subscription
254
+ # @param request [Hash] Request payload hash
195
255
  def order_update_recurring request={}
196
256
  call_params = base_call_params __method__
197
257
  call_params[:body] = {
@@ -201,6 +261,8 @@ class LimeLightPlatform < AppBase
201
261
  common_perform_post call_params
202
262
  end
203
263
 
264
+ # Updates an order record according to various criteria
265
+ # @param request [Hash] Request payload hash
204
266
  def order_update request={}
205
267
  call_params = base_call_params __method__
206
268
  call_params[:body] = { 'sync_all' => get_if_exists('sync_all', request, 0) }
@@ -254,26 +316,35 @@ class LimeLightPlatform < AppBase
254
316
  common_update_perform_post call_params, request, 'order_id', update_options
255
317
  end
256
318
 
319
+ #
320
+ # @param request [Hash] Request payload hash
257
321
  def order_view request={}
258
322
  call_params = base_call_params __method__
259
323
  call_params[:body] = { 'order_id' => get_if_exists('order_id', request, []) }
260
324
  common_perform_post call_params
261
325
  end
262
326
 
327
+ # @param request [Hash] Request payload hash
263
328
  def product_attribute_index request={}
264
329
  call_params = base_call_params __method__
265
330
  call_params[:body] = { 'product_id' => get_if_exists('product_id', request, []) }
266
331
  common_perform_post call_params
267
332
  end
268
333
 
334
+ # Return all product bundles in a CRM instance
269
335
  def product_bundle_index
270
336
  common_perform_post base_call_params(__method__)
271
337
  end
272
338
 
339
+ # Retrieve product bundle data for a specified product ID
340
+ # This product must be a bundle
341
+ # @param product_id [Integer] Product ID from CRM instance
273
342
  def product_bundle_view product_id
274
343
  common_entity_view_perform_post base_call_params(__method__), 'product_id', product_id
275
344
  end
276
345
 
346
+ # Copy a product record
347
+ # @param request [Hash] Request payload hash
277
348
  def product_copy request={}
278
349
  call_params = base_call_params __method__
279
350
  call_params[:body] = { 'product_id' => get_if_exists('product_id', request, 0) }
@@ -285,6 +356,8 @@ class LimeLightPlatform < AppBase
285
356
  common_perform_post call_params
286
357
  end
287
358
 
359
+ # Create a product record
360
+ # @param request [Hash] Request payload hash
288
361
  def product_create request={}
289
362
  call_params = base_call_params __method__
290
363
  call_params[:body] = {
@@ -312,10 +385,14 @@ class LimeLightPlatform < AppBase
312
385
  common_perform_post call_params
313
386
  end
314
387
 
388
+ # Delete a product record
389
+ # @param product_id [Integer] Product ID from CRM instance
315
390
  def product_delete product_id
316
391
  common_entity_view_perform_post base_call_params(__method__), 'product_id', product_id
317
392
  end
318
393
 
394
+ # Update a product record
395
+ # @param request [Hash] Request payload hash
319
396
  def product_update request={}
320
397
  call_params = base_call_params __method__
321
398
  update_options = [
@@ -343,6 +420,8 @@ class LimeLightPlatform < AppBase
343
420
  common_update_perform_post call_params, request, 'product_id', update_options
344
421
  end
345
422
 
423
+ # Search for a prospect record according to one or more criteria
424
+ # @param request [Hash] Request payload hash
346
425
  def prospect_find request={}
347
426
  call_params = base_call_params __method__
348
427
  date_times = default_date_times
@@ -362,6 +441,8 @@ class LimeLightPlatform < AppBase
362
441
  common_perform_post call_params
363
442
  end
364
443
 
444
+ # Update a prospect record
445
+ # @param request [Hash] Request payload hash
365
446
  def prospect_update request={}
366
447
  call_params = base_call_params __method__
367
448
  update_options = [
@@ -380,6 +461,8 @@ class LimeLightPlatform < AppBase
380
461
  common_update_perform_post call_params, request, 'prospect_id', update_options
381
462
  end
382
463
 
464
+ # Retrieve prospect data for a specified prospect ID
465
+ # @param request [Hash] Request payload hash
383
466
  def prospect_view request={}
384
467
  call_params = base_call_params __method__
385
468
  call_params[:body] = {
@@ -388,10 +471,44 @@ class LimeLightPlatform < AppBase
388
471
  common_perform_post call_params
389
472
  end
390
473
 
474
+ # Attempt to send an order to fulfillment
475
+ # @param order_id [Integer] The order ID from CRM instance
476
+ def repost_to_fulfillment order_id
477
+ common_entity_view_perform_post base_call_params(__method__), 'order_id', order_id
478
+ end
479
+
480
+ # Retrieve shipping method data based upon criteria
481
+ # @param request [Hash] Request payload hash
482
+ def shipping_method_find request={}
483
+ call_params = base_call_params __method__
484
+ call_params[:body] = {
485
+ 'campaign_id' => get_if_exists('campaign_id', request, 'all'),
486
+ 'search_type' => get_if_exists('search_type', request, 'any') # could be all
487
+ }
488
+
489
+ # criteria options: code, name, group
490
+ if key_exists('criteria', request)
491
+ call_params[:body]['criteria'] = request['criteria']
492
+ end
493
+
494
+ common_perform_post call_params
495
+ end
496
+
497
+ # Retrieve shipping method data for a specified shipping ID
498
+ # @param shipping_id [Integer] The shipping method ID from CRM instance
499
+ def shipping_method_view shipping_id
500
+ common_entity_view_perform_post base_call_params(__method__), 'shipping_id', shipping_id
501
+ end
502
+
503
+ # Skips the next billing cycle on a recurring subscription by updating the recurring date
504
+ # according to billing model configurations
505
+ # @param subscription_id [String] Subscription ID on the order
391
506
  def skip_next_billing subscription_id
392
507
  common_entity_view_perform_post base_call_params(__method__), 'subscription_id', subscription_id
393
508
  end
394
509
 
510
+ # Update one or more dynamic properties on a recurring subscription
511
+ # @param request [Hash] Request payload hash
395
512
  def subscription_order_update request={}
396
513
  call_params = base_call_params __method__
397
514
  call_params[:body]['order_id'] = get_if_exists 'order_id', request
@@ -408,12 +525,16 @@ class LimeLightPlatform < AppBase
408
525
  common_optional_param_perform_post call_params, optional_params, request
409
526
  end
410
527
 
528
+ # Stop, start, or reset a subscription
529
+ # @param request [Hash] Request payload hash
411
530
  def subscription_update request={}
412
531
  call_params = base_call_params __method__
413
532
  call_params[:body] = { 'subscription_id' => get_if_exists('subscription_id', request, {}) }
414
533
  common_perform_post call_params
415
534
  end
416
535
 
536
+ # Stops the recurring status of an upsell product on a subscriptions
537
+ # @param request [Hash] Request payload hash
417
538
  def upsell_stop_recurring request={}
418
539
  call_params = base_call_params __method__
419
540
  call_params[:body] = {
@@ -423,6 +544,7 @@ class LimeLightPlatform < AppBase
423
544
  common_perform_post call_params
424
545
  end
425
546
 
547
+ # Validates the API user username and password
426
548
  def validate_credentials
427
549
  common_perform_post(base_call_params(__method__))
428
550
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'lime_light_platform'
3
- s.version = '1.0.0.17'
3
+ s.version = '1.0.0.18'
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)"
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#coupon_validate " do
4
+ context "Lime Light Platform - Membership API - coupon_validate " do
5
+ it "Validates a coupon promo code" 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
+ products = [
14
+ {
15
+ 'product_id' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_PRODUCT_ID_1'],
16
+ 'quantity' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_PRODUCT_QUANTITY_1']
17
+ }
18
+ ]
19
+ response = lime_light.coupon_validate({
20
+ 'campaign_id' => ENV['TEST_COUPON_VALIDATE_CAMPAIGN_ID'],
21
+ 'shipping_id' => ENV['TEST_COUPON_VALIDATE_SHIPPING_ID'],
22
+ 'promo_code' => ENV['TEST_COUPON_VALIDATE_PROMO_CODE'],
23
+ 'email' => ENV['TEST_COUPON_VALIDATE_EMAIL'],
24
+ 'products' => [products.sample]
25
+ })
26
+ expect(response[:success]).to eq true
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#get_alternative_provider" do
4
+ context "Lime Light Platform - Membership API - get_alternative_provider" do
5
+ it "Fetches alternative provider API information" 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
+ products = [
14
+ {
15
+ 'product_id' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_PRODUCT_ID_1'],
16
+ 'quantity' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_PRODUCT_QUANTITY_1']
17
+ }
18
+ ]
19
+ response = lime_light.get_alternative_provider({
20
+ 'campaign_id' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_CAMPAIGN_ID'],
21
+ 'alt_pay_type' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_ALT_PAY_TYPE'],
22
+ 'return_url' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_RETURN_URL'],
23
+ 'cancel_url' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_CANCEL_URL'],
24
+ 'amount' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_AMOUNT'],
25
+ 'shipping_id' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_SHIPPING_ID'],
26
+ 'bill_country' => ENV['TEST_GET_ALTERNATIVE_PROVIDER_BILL_COUNTRY'],
27
+ 'products' => products.sample
28
+ })
29
+ expect(response[:success]).to eq true
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#repost_to_fulfillment" do
4
+ context "Lime Light Platform - Membership API - repost_to_fulfillment" do
5
+ it "Attempts to send an order to fulfillment" 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.repost_to_fulfillment ENV['TEST_REPOST_TO_FULFILLMENT_ORDER_ID']
14
+ expect(response[:success]).to eq true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#shipping_method_find" do
4
+ context "Lime Light Platform - Membership API - shipping_method_find" do
5
+ it "Searches for a shipping method 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
+ true
12
+ )
13
+ criteria = [
14
+ { 'code' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_CODE'] },
15
+ {
16
+ 'code' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_CODE'],
17
+ 'name' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_NAME']
18
+ },
19
+ { 'group' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_GROUP'] },
20
+ {
21
+ 'group' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_GROUP'],
22
+ 'name' => ENV['TEST_SHIPPING_METHOD_FIND_CRITERIA_NAME']
23
+ },
24
+ ]
25
+ response = lime_light.shipping_method_find({
26
+ 'campaign_id' => ENV['TEST_SHIPPING_METHOD_FIND_CAMPAIGN_ID'],
27
+ 'search_type' => ENV['TEST_SHIPPING_METHOD_FIND_SEARCH_TYPE'],
28
+ 'criteria' => criteria.sample
29
+ })
30
+ expect(response[:success]).to eq true
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#shipping_method_view" do
4
+ context "Lime Light Platform - Membership API - shipping_method_view" do
5
+ it "Returns data payload for a specified shipping method" 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.shipping_method_view ENV['TEST_SHIPPING_METHOD_VIEW_SHIPPING_ID']
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.17
4
+ version: 1.0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marvin Titus-Casseus
@@ -27,12 +27,15 @@ files:
27
27
  - lime_light_platform-1.0.0.14.gem
28
28
  - lime_light_platform-1.0.0.15.gem
29
29
  - lime_light_platform-1.0.0.16.gem
30
+ - lime_light_platform-1.0.0.17.gem
30
31
  - lime_light_platform.gemspec
31
32
  - spec/billing_model_view_spec.rb
32
33
  - spec/campaign_find_active_spec.rb
33
34
  - spec/campaign_view_spec.rb
35
+ - spec/coupon_validate_spec.rb
34
36
  - spec/customer_view_spec.rb
35
37
  - spec/gateway_view_spec.rb
38
+ - spec/get_alternative_provider_spec.rb
36
39
  - spec/new_order_spec.rb
37
40
  - spec/offer_view_spec.rb
38
41
  - spec/order_find_spec.rb
@@ -52,6 +55,9 @@ files:
52
55
  - spec/prospect_find_spec.rb
53
56
  - spec/prospect_update_spec.rb
54
57
  - spec/prospect_view_spec.rb
58
+ - spec/repost_to_fulfillment_spec.rb
59
+ - spec/shipping_method_find_spec.rb
60
+ - spec/shipping_method_view_spec.rb
55
61
  - spec/skip_next_billing_spec.rb
56
62
  - spec/spec_helper.rb
57
63
  - spec/subscription_order_update_spec.rb