workarea-listrak 5.0.2 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5aaea07505fcf5a5d98d1cdd97fd87c078fd158e0b328ee52988bb205b9e237
4
- data.tar.gz: 6841e30c1dbe474eea5e8644656621d1992c55bc34e2c43d30406e2e15576023
3
+ metadata.gz: adc6b2b9f326e598e599a6051a0d31a331c07991160fe644ac56bdf223ebf874
4
+ data.tar.gz: af9c49ae07e17142cd958332ad3eb87b23e6c0be4c60ced7c071b77830cfe972
5
5
  SHA512:
6
- metadata.gz: 345c9b02dfcee01da5820c6774548213c6d605f731daf217d5f88b8623d98209f15e3e9e3f7680ce274260363a812093ec64d847fc167addafca1383c6364200
7
- data.tar.gz: 27a5b2648753cde1f0a7416d0a3412d7e0ee032a623c49af15a0c72c6e4bc6530fe60f46d5b9c28ae8b2c46f4a538394e607e87adbedf62f84622371fed6b024
6
+ metadata.gz: 4aeeb4a36e112aba784ae1653ca47e1af635017ebe24fde80636f7ba208f86c6bdb99b3878c52ff9eae3fcbd8efe63d3c7c716753239ba77b82b51dc8ed6c27f
7
+ data.tar.gz: 3b887af7e5dc99b0b98f85f62c2e31239442b1162ce4572a25de5ab1a2275814f549f32cc19350469fc3b81289f7b271b8991150f5874f960840ba6100adcd6c
@@ -0,0 +1,57 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ static_analysis:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v1
9
+ - uses: workarea-commerce/ci/bundler-audit@v1
10
+ - uses: workarea-commerce/ci/rubocop@v1
11
+ - uses: workarea-commerce/ci/eslint@v1
12
+ with:
13
+ args: '**/*.js'
14
+
15
+ admin_tests:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v1
19
+ - uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: 2.6.x
22
+ - uses: workarea-commerce/ci/test@v1
23
+ with:
24
+ command: bin/rails app:workarea:test:admin
25
+
26
+ core_tests:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v1
30
+ - uses: actions/setup-ruby@v1
31
+ with:
32
+ ruby-version: 2.6.x
33
+ - uses: workarea-commerce/ci/test@v1
34
+ with:
35
+ command: bin/rails app:workarea:test:core
36
+
37
+ storefront_tests:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v1
41
+ - uses: actions/setup-ruby@v1
42
+ with:
43
+ ruby-version: 2.6.x
44
+ - uses: workarea-commerce/ci/test@v1
45
+ with:
46
+ command: bin/rails app:workarea:test:storefront
47
+
48
+ plugins_tests:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v1
52
+ - uses: actions/setup-ruby@v1
53
+ with:
54
+ ruby-version: 2.6.x
55
+ - uses: workarea-commerce/ci/test@v1
56
+ with:
57
+ command: bin/rails app:workarea:test:plugins
data/.gitignore CHANGED
@@ -13,6 +13,7 @@
13
13
  Gemfile.lock
14
14
  test/dummy/tmp/export/*.csv
15
15
  .DS_Store
16
+ node_modules/
16
17
 
17
18
  ## Documentation cache and generated files:
18
19
  /.yardoc/
@@ -30,3 +31,4 @@ log
30
31
  tmp
31
32
  test/dummy/public/system/
32
33
  coverage
34
+ .rubocop-http*
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/workarea-commerce/workarea/master/.rubocop.yml
3
+
data/.stylelintrc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "stylelint-config-recommended-scss",
3
+ "rules": {
4
+ "block-no-empty": null,
5
+ "no-descending-specificity": null,
6
+ "property-no-unknown": [true, { "ignoreProperties": ["mso-hide"] }]
7
+ }
8
+ }
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ Workarea Listrak 5.0.3 (2020-02-05)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Fix Proxy Usage in OAuth Client
5
+
6
+ When obtaining an OAuth access token from Listrak, requests were not
7
+ being sent through the HTTP proxy set in `$http_proxy` due to the way
8
+ the `Net::HTTP` library was being used. To resolve this, refactor the
9
+ `Listrak::OAuth.token` code to make a request using an instance of the
10
+ `Net::HTTP` client, rather than by using the `.post_form` convenience
11
+ method, as this is the only way to use the proxy in production.
12
+
13
+ Fixes #2
14
+
15
+ LISTRAK-1
16
+ Tom Scott
17
+
18
+ * Update README
19
+
20
+ Matt Duffy
21
+
22
+
23
+
1
24
  Workarea Listrak 5.0.2 (2019-08-22)
2
25
  --------------------------------------------------------------------------------
3
26
 
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source "https://rubygems.org"
2
- source "https://gems.weblinc.com"
3
2
 
4
3
  gemspec
5
4
 
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Listrak
1
+ Workarea Listrak
2
+ ================================================================================
2
3
 
3
4
  Integrate the [Listrak][] ERP with the Workarea platform. This plugin
4
5
  currently implements the following Listrak features:
@@ -8,15 +9,25 @@ currently implements the following Listrak features:
8
9
  - Transactional email delivery
9
10
  - Automatically subscribing users to a distribution list
10
11
 
11
- ## Installation
12
+ Getting Started
13
+ --------------------------------------------------------------------------------
12
14
 
13
- Add the following to Gemfile:
15
+ Add the gem to your application's Gemfile:
14
16
 
15
17
  ```ruby
16
- gem 'workarea-listrak', '~> 5.0'
18
+ # ...
19
+ gem 'workarea-listrak'
20
+ # ...
17
21
  ```
18
22
 
19
- ### Secrets
23
+ Update your application's bundle.
24
+
25
+ ```bash
26
+ cd path/to/application
27
+ bundle
28
+ ```
29
+
30
+ Update your `config/secrets.yml` file with your api credentials:
20
31
 
21
32
  ```yaml
22
33
  listrak:
@@ -28,7 +39,8 @@ listrak:
28
39
  client_secret:
29
40
  ```
30
41
 
31
- ### Configuration
42
+ Configuration
43
+ --------------------------------------------------------------------------------
32
44
 
33
45
  Most listrak configuration is set via the admin; you will need to set the
34
46
  `Default List` in the admin after installing the plugin.
@@ -39,19 +51,21 @@ Most listrak configuration is set via the admin; you will need to set the
39
51
  Workarea.config do |config|
40
52
  config.listrak.analytics = {
41
53
  merchant_id: 'LISTRAK MERCHANT ID',
42
- email_capture_ids: 'ID's OF EMAIL FIELDS USED FOR JAVASCRIPT ABANDONMENT'
54
+ email_capture_ids: 'EMAIL FIELD IDS USED FOR JAVASCRIPT ABANDONMENT'
43
55
  }
44
56
  end
45
57
  ```
46
58
 
47
- ### Subscribing email addresses to a distribution list
59
+ Subscribing email addresses to a distribution list
60
+ --------------------------------------------------------------------------------
48
61
 
49
62
  When customers sign up for the newsletter within the popup dialog or
50
63
  create a new user account, `Workarea::Listrak` will send the email and
51
64
  any other user-specific information to Listrak. This occurs immediately
52
65
  in a background job during creation of a `Email::Signup`.
53
66
 
54
- ### Data Exporting
67
+ Data Exporting
68
+ --------------------------------------------------------------------------------
55
69
 
56
70
  The following will be sent to Listrak via API whenever they are created or saved:
57
71
 
@@ -59,7 +73,8 @@ The following will be sent to Listrak via API whenever they are created or saved
59
73
  * Orders (on order place)
60
74
  * Products
61
75
 
62
- ### Transactional Email Delivery
76
+ Transactional Email Delivery
77
+ --------------------------------------------------------------------------------
63
78
 
64
79
  This library is capable of replacing the internal application mailers
65
80
  with API calls to Listrak's email delivery service, passing it the data
@@ -110,7 +125,8 @@ To send the message, call the `#deliver` method:
110
125
  OrderConfirmationMessage.new(order).deliver
111
126
  ```
112
127
 
113
- ### JavaScript Analytics Integration
128
+ JavaScript Analytics Integration
129
+ --------------------------------------------------------------------------------
114
130
 
115
131
  All of Listrak's JS code blocks respond to the `listrakAsyncListener`
116
132
  event, which is triggered after Listrak's external "SDK" code is loaded
@@ -128,3 +144,13 @@ To reiterate, **listrak.js needs to be your last initialized JS
128
144
  module**.
129
145
 
130
146
  [Listrak]: http://listrak.com
147
+
148
+ Workarea Commerce Documentation
149
+ --------------------------------------------------------------------------------
150
+
151
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation.
152
+
153
+ License
154
+ --------------------------------------------------------------------------------
155
+
156
+ Workarea Listrak is released under the [Business Software License](LICENSE)
data/Rakefile CHANGED
@@ -38,13 +38,12 @@ desc "Release version #{Workarea::Listrak::VERSION} of the gem"
38
38
  task :release do
39
39
  host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
40
40
 
41
- #Rake::Task['workarea:changelog'].execute
42
- #system 'git add CHANGELOG.md'
43
- #system 'git commit -m "Update CHANGELOG"'
44
- #system 'git push origin HEAD'
41
+ Rake::Task['workarea:changelog'].execute
42
+ system 'git add CHANGELOG.md'
43
+ system 'git commit -m "Update CHANGELOG"'
45
44
 
46
45
  system "git tag -a v#{Workarea::Listrak::VERSION} -m 'Tagging #{Workarea::Listrak::VERSION}'"
47
- system "git push --tags"
46
+ system "git push origin HEAD --follow-tags"
48
47
 
49
48
  system "gem build workarea-listrak.gemspec"
50
49
  system "gem push workarea-listrak-#{Workarea::Listrak::VERSION}.gem"
@@ -1,7 +1,6 @@
1
1
  module Workarea
2
2
  module Listrak
3
3
  class EmailApi::Contacts
4
-
5
4
  attr_reader :client
6
5
 
7
6
  def initialize(client)
@@ -2,7 +2,6 @@ module Workarea
2
2
  module Listrak
3
3
  module Models
4
4
  class OrderItem
5
-
6
5
  attr_reader :order, :order_item
7
6
 
8
7
  def initialize(order, order_item)
@@ -5,28 +5,20 @@ module Workarea
5
5
  #
6
6
  # @param client_id [String] client id
7
7
  # @param client_secret [String] client secret
8
- # @param options [Hash] extra options when getting the OAuth token
9
- # @option options [Integer] timeout value for open and read timeouts
10
- # @option options [Integer] open_timeout value for open timeout
11
- # @option options [Integer] read_timeout value for read timeout
12
- #
13
8
  # @raise [OauthError] raised if generating an Oauth token is unsucessful
14
- #
15
9
  # @return [String] Oauth token
16
- def self.token(client_id:, client_secret:, **options)
10
+ def self.token(client_id:, client_secret:)
17
11
  cache_key = "listrak/api/#{client_id}"
18
12
  token = Rails.cache.read(cache_key)
19
13
 
20
14
  return token if token.present?
21
15
 
22
- uri = URI('https://auth.listrak.com/OAuth2/Token')
23
- params = {
16
+ payload = {
24
17
  grant_type: 'client_credentials',
25
18
  client_id: client_id,
26
19
  client_secret: client_secret
27
20
  }
28
-
29
- response = Net::HTTP.post_form uri, params
21
+ response = http.post('/OAuth2/Token', payload.to_json)
30
22
 
31
23
  case response
32
24
  when ::Net::HTTPSuccess
@@ -40,6 +32,12 @@ module Workarea
40
32
  raise OauthError.new response
41
33
  end
42
34
  end
35
+
36
+ def self.http
37
+ @http ||= Net::HTTP.new('auth.listrak.com', 443).tap do |client|
38
+ client.use_ssl = true
39
+ end
40
+ end
43
41
  end
44
42
  end
45
43
  end
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module Listrak
3
- VERSION = "5.0.2".freeze
3
+ VERSION = "5.0.3".freeze
4
4
  end
5
5
  end
@@ -5,8 +5,10 @@ module Workarea
5
5
  class OauthTest < TestCase
6
6
  def test_token_with_valid_credentials
7
7
  VCR.use_cassette "listrak/oauth-successful" do
8
- token = Oauth.token client_id: 'doyfni0aw64ogd84ld6t',
8
+ token = Oauth.token(
9
+ client_id: 'doyfni0aw64ogd84ld6t',
9
10
  client_secret: 'LxdEE4Gu4aSJv5tS9osd8WudjGbJ+EIPYvZBS7bc5JU'
11
+ )
10
12
 
11
13
  assert token.present?
12
14
  end
@@ -15,13 +17,29 @@ module Workarea
15
17
  def test_token_with_invalid_credentials
16
18
  VCR.use_cassette "listrak/oauth-unsuccessful" do
17
19
  error = assert_raises Listrak::OauthError do
18
- Oauth.token client_id: 'doyfni0aw64ogd84ld6t',
20
+ Oauth.token(
21
+ client_id: 'doyfni0aw64ogd84ld6t',
19
22
  client_secret: 'LxdEE4Gu4aSJv5tS9osd8WudjGbJ+EIPYvZBS7bc5J'
23
+ )
20
24
  end
21
25
 
22
26
  assert_equal({ error: "Invalid Credentials" }.to_json, error.message)
23
27
  end
24
28
  end
29
+
30
+ def test_request_token_through_proxy_when_provided
31
+ proxy = ENV['http_proxy']
32
+ ENV['http_proxy'] = '127.0.0.1'
33
+
34
+ assert_raises SocketError do
35
+ Oauth.token(
36
+ client_id: 'doyfni0aw64ogd84ld6t',
37
+ client_secret: 'LxdEE4Gu4aSJv5tS9osd8WudjGbJ+EIPYvZBS7bc5J'
38
+ )
39
+ end
40
+ ensure
41
+ ENV['http_proxy'] = proxy
42
+ end
25
43
  end
26
44
  end
27
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-listrak
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Pigeon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -43,13 +43,15 @@ files:
43
43
  - ".github/ISSUE_TEMPLATE/bug_report.md"
44
44
  - ".github/ISSUE_TEMPLATE/documentation-request.md"
45
45
  - ".github/ISSUE_TEMPLATE/feature_request.md"
46
+ - ".github/workflows/ci.yml"
46
47
  - ".gitignore"
48
+ - ".rubocop.yml"
49
+ - ".stylelintrc.json"
47
50
  - CHANGELOG.md
48
51
  - CODE_OF_CONDUCT.md
49
52
  - CONTRIBUTING.md
50
53
  - Gemfile
51
54
  - LICENSE
52
- - LICENSE.md
53
55
  - README.md
54
56
  - Rakefile
55
57
  - app/assets/javascripts/workarea/admin/modules/listrak/list_events_select.js
@@ -146,7 +148,6 @@ files:
146
148
  - test/dummy/config/initializers/inflections.rb
147
149
  - test/dummy/config/initializers/mime_types.rb
148
150
  - test/dummy/config/initializers/new_framework_defaults.rb
149
- - test/dummy/config/initializers/session_store.rb
150
151
  - test/dummy/config/initializers/workarea.rb
151
152
  - test/dummy/config/initializers/wrap_parameters.rb
152
153
  - test/dummy/config/locales/en.yml
@@ -155,6 +156,7 @@ files:
155
156
  - test/dummy/config/secrets.yml
156
157
  - test/dummy/config/spring.rb
157
158
  - test/dummy/db/seeds.rb
159
+ - test/dummy/log/.keep
158
160
  - test/dummy/public/404.html
159
161
  - test/dummy/public/422.html
160
162
  - test/dummy/public/500.html
@@ -220,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
222
  - !ruby/object:Gem::Version
221
223
  version: '0'
222
224
  requirements: []
223
- rubygems_version: 3.0.4
225
+ rubygems_version: 3.0.6
224
226
  signing_key:
225
227
  specification_version: 4
226
228
  summary: Listrak plugin for Workarea
data/LICENSE.md DELETED
@@ -1,3 +0,0 @@
1
- View this plugin's license here:
2
-
3
- <https://github.com/workarea-commerce/workarea/blob/master/LICENSE.md>
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: "_dummy_session"