lime_light_platform 1.0.0.14 → 1.0.0.15

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: f04e75d5944c843fa91ebde76c6e6c2257f929c71f1e5b394c6ac81afbf7dcd5
4
- data.tar.gz: fb40c35e54d0a17476a98a5c1122f640e0c5c06ce804581c1be4b1cb5e43ec18
3
+ metadata.gz: a8f9891a2f22cf55275d0096295ca483c400edf7bba69db55db2f2a3e41e783d
4
+ data.tar.gz: 2210ba3db45baf80089270e92ca3923e9b707f42a57bc6160e2b1556d1b539ad
5
5
  SHA512:
6
- metadata.gz: 59b210afd6881eb4aaf69810f137a8083e2c479f4926ee18df5d8b6222ec5fc3f0c65c51bac1fc18623e6cd3a32ea679ad9e42a0989cc5bf4730352e0d593f72
7
- data.tar.gz: bc27d88cc2a628288d9cbaf0df3f038fcc85a4af6ff226b9c9daee8e201adb712c0302d8d6acd40d0fed420f6da06989d08f9248d5c8e7fb664ea4377123206b
6
+ metadata.gz: 1d9773c695ce28f6870461d4aa88592788a218103545a30f7dd1cc37f149085ee3e07fa3e4c7c13f533d152e980f76890f21a06323a008f4af856286fa72bf7a
7
+ data.tar.gz: 691ed15fead9b5058ebb2a85b2afaa2ba693e7c348cc30d230126d154bd4f23cc0003edba40a37ce71fff671a12da2fa63165f11c9f62aec37134fd8ad9cfc4f
@@ -39,9 +39,17 @@ class LimeLightPlatform < AppBase
39
39
  end
40
40
  end
41
41
 
42
- def billing_model_view offer_id
42
+ def billing_model_view request={}
43
43
  call_params = base_call_params __method__
44
- call_params[:body]['offer_id'] = offer_id
44
+
45
+ if key_exists('offer_id', request)
46
+ call_params[:body]['offer_id'] = request['offer_id']
47
+ end
48
+
49
+ if key_exists('billing_model_id', request)
50
+ call_params[:body]['billing_model_id'] = request['billing_model_id']
51
+ end
52
+
45
53
  common_perform_post call_params
46
54
  end
47
55
 
@@ -73,15 +81,15 @@ class LimeLightPlatform < AppBase
73
81
  end
74
82
 
75
83
  def campaign_view campaign_id
76
- call_params = base_call_params __method__
77
- call_params[:body]['campaign_id'] = campaign_id
78
- common_perform_post call_params
84
+ common_entity_view_perform_post base_call_params(__method__), 'campaign_id', campaign_id
85
+ end
86
+
87
+ def customer_view customer_id
88
+ common_entity_view_perform_post base_call_params(__method__), 'customer_id', customer_id
79
89
  end
80
90
 
81
91
  def gateway_view gateway_id
82
- call_params = base_call_params __method__
83
- call_params[:body]['gateway_id'] = gateway_id
84
- common_perform_post call_params
92
+ common_entity_view_perform_post base_call_params(__method__), 'gateway_id', gateway_id
85
93
  end
86
94
 
87
95
  def new_order request={}
@@ -125,9 +133,17 @@ class LimeLightPlatform < AppBase
125
133
  common_perform_post call_params
126
134
  end
127
135
 
128
- def offer_view campaign_id
136
+ def offer_view request={}
129
137
  call_params = base_call_params __method__
130
- call_params[:body]['campaign_id'] = campaign_id
138
+
139
+ if key_exists('offer_id', request)
140
+ call_params[:body]['offer_id'] = request['offer_id']
141
+ end
142
+
143
+ if key_exists('campaign_id', request)
144
+ call_params[:body]['campaign_id'] = request['campaign_id']
145
+ end
146
+
131
147
  common_perform_post call_params
132
148
  end
133
149
 
@@ -320,6 +336,51 @@ class LimeLightPlatform < AppBase
320
336
  common_update_perform_post call_params, request, 'product_id', update_options
321
337
  end
322
338
 
339
+ def prospect_find request={}
340
+ call_params = base_call_params __method__
341
+ date_times = default_date_times
342
+ call_params[:body] = {
343
+ 'campaign_id' => get_if_exists('campaign_id', request, 'all'),
344
+ 'start_date' => get_if_exists('start_date', request, date_times[:today]),
345
+ 'end_date' => get_if_exists('end_date', request, date_times[:today]),
346
+ 'start_time' => get_if_exists('start_time', request, date_times[:start_time]),
347
+ 'end_time' => get_if_exists('end_time', request, date_times[:end_time]),
348
+ 'search_type' => get_if_exists('search_type', request, 'any'), # could be all
349
+ }
350
+
351
+ if key_exists('criteria', request)
352
+ call_params[:body]['criteria'] = request['criteria']
353
+ end
354
+
355
+ common_perform_post call_params
356
+ end
357
+
358
+ def prospect_update request={}
359
+ call_params = base_call_params __method__
360
+ update_options = [
361
+ 'first_name',
362
+ 'last_name',
363
+ 'address',
364
+ 'address2',
365
+ 'city',
366
+ 'state',
367
+ 'zip',
368
+ 'country',
369
+ 'phone',
370
+ 'email',
371
+ 'notes'
372
+ ]
373
+ common_update_perform_post call_params, request, 'prospect_id', update_options
374
+ end
375
+
376
+ def prospect_view request={}
377
+ call_params = base_call_params __method__
378
+ call_params[:body] = {
379
+ 'prospect_id' => get_if_exists('prospect_id', request, [])
380
+ }
381
+ common_perform_post call_params
382
+ end
383
+
323
384
  def subscription_order_update
324
385
  response = default_response
325
386
  response
@@ -352,6 +413,11 @@ class LimeLightPlatform < AppBase
352
413
  { success: false, code: nil, data: [], raw: '' }
353
414
  end
354
415
 
416
+ def common_entity_view_perform_post call_params, record_key, record_id
417
+ call_params[:body][record_key] = record_id
418
+ common_perform_post call_params
419
+ end
420
+
355
421
  def common_perform_post call_params
356
422
  response = default_response
357
423
  api_response = perform_api_call call_params
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'lime_light_platform'
3
- s.version = '1.0.0.14'
3
+ s.version = '1.0.0.15'
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)"
@@ -10,7 +10,15 @@ RSpec.describe LimeLightPlatform, "#billing_model_view" do
10
10
  ENV['DEV_SUB'],
11
11
  false
12
12
  )
13
- response = lime_light.billing_model_view ENV['TEST_OFFER_ID_1']
13
+ possible_params = [
14
+ {'offer_id' => ENV['TEST_BILLING_MODEL_VIEW_OFFER_ID']},
15
+ {'billing_model_id' => ENV['TEST_BILLING_MODEL_VIEW_BILLING_MODEL_ID']},
16
+ {
17
+ 'offer_id' => ENV['TEST_BILLING_MODEL_VIEW_OFFER_ID'],
18
+ 'billing_model_id' => ENV['TEST_BILLING_MODEL_VIEW_BILLING_MODEL_ID']
19
+ },
20
+ ]
21
+ response = lime_light.billing_model_view possible_params.sample
14
22
  expect(response[:success]).to eq true
15
23
  end
16
24
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#customer_view" do
4
+ context "Lime Light Platform - Membership API - customer_view" do
5
+ it "Returns data that describes a given customer" 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.customer_view ENV['TEST_CUSTOMER_VIEW_CUSTOMER_ID']
14
+ expect(response[:success]).to eq true
15
+ end
16
+ end
17
+ end
@@ -10,7 +10,15 @@ RSpec.describe LimeLightPlatform, "#offer_view" do
10
10
  ENV['DEV_SUB'],
11
11
  false
12
12
  )
13
- response = lime_light.offer_view ENV['TEST_OFFER_VIEW_CAMPAIGN_ID']
13
+ possible_params = [
14
+ {'offer_id' => ENV['TEST_OFFER_VIEW_OFFER_ID']},
15
+ {'campaign_id' => ENV['TEST_OFFER_VIEW_CAMPAIGN_ID']},
16
+ {
17
+ 'offer_id' => ENV['TEST_OFFER_VIEW_OFFER_ID'],
18
+ 'campaign_id' => ENV['TEST_OFFER_VIEW_CAMPAIGN_ID']
19
+ },
20
+ ]
21
+ response = lime_light.offer_view possible_params.sample
14
22
  expect(response[:success]).to eq true
15
23
  end
16
24
  end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#prospect_find" do
4
+ context "Lime Light Platform - Membership API - prospect_find" do
5
+ it "Searches for a prospect" 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
+ possible_criteria = [
14
+ {
15
+ 'first_name' => ENV['TEST_PROSPECT_FIND_CRITERIA_FIRST_NAME'],
16
+ 'last_name' => ENV['TEST_PROSPECT_FIND_CRITERIA_LAST_NAME']
17
+ },
18
+ {
19
+ 'address' => ENV['TEST_PROSPECT_FIND_CRITERIA_ADDRESS'],
20
+ 'city' => ENV['TEST_PROSPECT_FIND_CRITERIA_CITY']
21
+ },
22
+ { 'state' => ENV['TEST_PROSPECT_FIND_CRITERIA_STATE'] },
23
+ { 'zip' => ENV['TEST_PROSPECT_FIND_CRITERIA_ZIP'] },
24
+ { 'country' => ENV['TEST_PROSPECT_FIND_CRITERIA_COUNTRY'] },
25
+ { 'phone' => ENV['TEST_PROSPECT_FIND_CRITERIA_PHONE'] },
26
+ { 'email' => ENV['TEST_PROSPECT_FIND_CRITERIA_EMAIL'] },
27
+ { 'ip_address' => ENV['TEST_PROSPECT_FIND_CRITERIA_IP_ADDRESS'] }
28
+ ]
29
+ response = lime_light.prospect_find({
30
+ 'campaign_id' => ENV['TEST_PROSPECT_FIND_CAMPAIGN_ID'],
31
+ 'start_date' => ENV['TEST_PROSPECT_FIND_START_DATE'],
32
+ 'end_date' => ENV['TEST_PROSPECT_FIND_END_DATE'],
33
+ 'start_time' => ENV['TEST_PROSPECT_FIND_START_TIME'],
34
+ 'end_time' => ENV['TEST_PROSPECT_FIND_END_TIME'],
35
+ 'search_type' => ENV['TEST_PROSPECT_FIND_SEARCH_TYPE'],
36
+ 'criteria' => possible_criteria.sample
37
+ })
38
+ expect(response[:success]).to eq true
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+ require 'faker'
3
+
4
+ RSpec.describe LimeLightPlatform, "#prospect_update" do
5
+ context "Lime Light Platform - Membership API - prospect_update" do
6
+ it "Updates a prospect" do
7
+ lime_light = LimeLightPlatform.new(
8
+ ENV['APP_KEY'],
9
+ ENV['API_USERNAME'],
10
+ ENV['API_PASSWORD'],
11
+ ENV['DEV_SUB'],
12
+ true
13
+ )
14
+ options = [
15
+ {
16
+ 'notes' => Faker::RickAndMorty.quote,
17
+ 'first_name' => Faker::Name.first_name,
18
+ 'last_name' => Faker::Name.last_name,
19
+ 'email' => Faker::Internet.email,
20
+ 'phone' => Faker::PhoneNumber.phone_number
21
+ },
22
+ {
23
+ 'address' => Faker::Address.street_address,
24
+ 'address2' => Faker::Address.secondary_address,
25
+ 'city' => Faker::Address.city
26
+ },
27
+ {
28
+ 'zip' => Faker::Address.postcode,
29
+ 'state' => Faker::Address.state_abbr,
30
+ 'country' => Faker::Address.country_code
31
+ }
32
+ ]
33
+ response = lime_light.prospect_update({
34
+ 'prospect_id' => {
35
+ ENV['TEST_PROSPECT_UPDATE_PROSPECT_ID_1'] => options.sample,
36
+ ENV['TEST_PROSPECT_UPDATE_PROSPECT_ID_2'] => options.sample,
37
+ ENV['TEST_PROSPECT_UPDATE_PROSPECT_ID_3'] => options.sample
38
+ }
39
+ })
40
+ expect(response[:success]).to eq true
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe LimeLightPlatform, "#prospect_view" do
4
+ context "Lime Light Platform - Membership API - prospect_view" do
5
+ it "Returns data that describes a given prospect" 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.prospect_view({
14
+ 'prospect_id' => [
15
+ ENV['TEST_PROSPECT_UPDATE_PROSPECT_ID_2'],
16
+ ENV['TEST_PROSPECT_UPDATE_PROSPECT_ID_3']
17
+ ]
18
+ })
19
+ expect(response[:success]).to eq true
20
+ end
21
+ end
22
+ 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.14
4
+ version: 1.0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marvin Titus-Casseus
@@ -24,10 +24,12 @@ files:
24
24
  - lib/lime_light_platform/helpers/accessor.rb
25
25
  - lime_light_platform-1.0.0.12.gem
26
26
  - lime_light_platform-1.0.0.13.gem
27
+ - lime_light_platform-1.0.0.14.gem
27
28
  - lime_light_platform.gemspec
28
29
  - spec/billing_model_view_spec.rb
29
30
  - spec/campaign_find_active_spec.rb
30
31
  - spec/campaign_view_spec.rb
32
+ - spec/customer_view_spec.rb
31
33
  - spec/gateway_view_spec.rb
32
34
  - spec/new_order_spec.rb
33
35
  - spec/offer_view_spec.rb
@@ -40,6 +42,9 @@ files:
40
42
  - spec/order_view_spec.rb
41
43
  - spec/product_create_spec.rb
42
44
  - spec/product_update_spec.rb
45
+ - spec/prospect_find_spec.rb
46
+ - spec/prospect_update_spec.rb
47
+ - spec/prospect_view_spec.rb
43
48
  - spec/spec_helper.rb
44
49
  - spec/validate_credentials_spec.rb
45
50
  homepage: https://rubygems.org/gems/lime_light_platform