mrkt 0.10.0 → 0.11.0

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: 4121a615d6e3099a58b81831bcfc5831aba8f331d22d3cfb98501ebcfb7c2272
4
- data.tar.gz: b7b345f6f78c47bef04395b88924bc62231b1fd49a27ce9dd91564ca87557db4
3
+ metadata.gz: 34dfc8094a0255c4319a97e68c0dcdc82cf37b14dc69f2fdf7d82b294c68928e
4
+ data.tar.gz: 397c0742e14b8d66bb7d88cb8c4560d25b1bc6d95df350be0c1904158de311cb
5
5
  SHA512:
6
- metadata.gz: a40cf98b97f10e619bb6066637567a946f26a6fef586c55bdfe7341ae102550be1d812e5e468cd13ca4cc12dfa772b9f697e431aeda728464e2150ea1148b4d7
7
- data.tar.gz: 2fccf0ded04505d6c7a0049bff1040876e74540adab38543aa7b35aa667f7f266f52df739158921547031796ffc9a18c2b89fd35f2a4c0a7b13ff97f0de86048
6
+ metadata.gz: 1facd66a3aefe58fb704d0d9851c681983b3cef751a8add539ed8f5380b2e24554bd1e38cac15aa5bfc0af50f0c51164975601b743c2641f9dbec7fa8d35a985
7
+ data.tar.gz: 9733940bd3342322818ba1172a863aa6d3c5c737b85ce7c7b82dfa72ec48430dd01cce111e2adda79c57ec74d78b7fa298d9bae1be051b0212b085c7d5d679bf
data/.travis.yml CHANGED
@@ -7,5 +7,7 @@ rvm:
7
7
  addons:
8
8
  code_climate:
9
9
  repo_token: 45cd2174f49b570406e294ff393d456c4ae8532cf16dd6430abb06d8a0722a28
10
+ before_install:
11
+ - gem update --system
10
12
  after_success:
11
13
  - bundle exec codeclimate-test-reporter
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrkt (0.10.0)
4
+ mrkt (0.11.0)
5
5
  faraday (> 0.9.0, < 0.16.0)
6
6
  faraday_middleware (> 0.9.0, < 0.16.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.6.0)
12
- public_suffix (>= 2.0.2, < 4.0)
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.0)
14
14
  byebug (11.0.1)
15
15
  codeclimate-test-reporter (1.0.9)
@@ -23,13 +23,13 @@ GEM
23
23
  multipart-post (>= 1.2, < 3)
24
24
  faraday_middleware (0.13.1)
25
25
  faraday (>= 0.7.4, < 1.0)
26
- hashdiff (0.3.8)
27
- jaro_winkler (1.5.2)
26
+ hashdiff (1.0.0)
27
+ jaro_winkler (1.5.4)
28
28
  json (2.2.0)
29
29
  method_source (0.9.2)
30
- multipart-post (2.0.0)
31
- parallel (1.14.0)
32
- parser (2.6.2.0)
30
+ multipart-post (2.1.1)
31
+ parallel (1.19.1)
32
+ parser (2.6.5.0)
33
33
  ast (~> 2.4.0)
34
34
  pry (0.12.2)
35
35
  coderay (~> 1.1.0)
@@ -38,22 +38,22 @@ GEM
38
38
  byebug (~> 11.0)
39
39
  pry (~> 0.10)
40
40
  psych (3.1.0)
41
- public_suffix (3.0.3)
41
+ public_suffix (4.0.1)
42
42
  rainbow (3.0.0)
43
- rake (12.3.2)
44
- rspec (3.8.0)
45
- rspec-core (~> 3.8.0)
46
- rspec-expectations (~> 3.8.0)
47
- rspec-mocks (~> 3.8.0)
48
- rspec-core (3.8.0)
49
- rspec-support (~> 3.8.0)
50
- rspec-expectations (3.8.2)
43
+ rake (12.3.3)
44
+ rspec (3.9.0)
45
+ rspec-core (~> 3.9.0)
46
+ rspec-expectations (~> 3.9.0)
47
+ rspec-mocks (~> 3.9.0)
48
+ rspec-core (3.9.0)
49
+ rspec-support (~> 3.9.0)
50
+ rspec-expectations (3.9.0)
51
51
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.8.0)
53
- rspec-mocks (3.8.0)
52
+ rspec-support (~> 3.9.0)
53
+ rspec-mocks (3.9.0)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.8.0)
56
- rspec-support (3.8.0)
55
+ rspec-support (~> 3.9.0)
56
+ rspec-support (3.9.0)
57
57
  rubocop (0.66.0)
58
58
  jaro_winkler (~> 1.5.1)
59
59
  parallel (~> 1.10)
@@ -62,7 +62,7 @@ GEM
62
62
  rainbow (>= 2.2.2, < 4.0)
63
63
  ruby-progressbar (~> 1.7)
64
64
  unicode-display_width (>= 1.4.0, < 1.6)
65
- ruby-progressbar (1.10.0)
65
+ ruby-progressbar (1.10.1)
66
66
  safe_yaml (1.0.5)
67
67
  simplecov (0.13.0)
68
68
  docile (~> 1.1.0)
@@ -70,10 +70,10 @@ GEM
70
70
  simplecov-html (~> 0.10.0)
71
71
  simplecov-html (0.10.2)
72
72
  unicode-display_width (1.5.0)
73
- webmock (3.5.1)
73
+ webmock (3.7.6)
74
74
  addressable (>= 2.3.6)
75
75
  crack (>= 0.3.2)
76
- hashdiff
76
+ hashdiff (>= 0.4.0, < 2.0.0)
77
77
 
78
78
  PLATFORMS
79
79
  ruby
@@ -89,4 +89,4 @@ DEPENDENCIES
89
89
  webmock (~> 3.1)
90
90
 
91
91
  BUNDLED WITH
92
- 1.17.2
92
+ 1.17.3
data/README.md CHANGED
@@ -32,6 +32,7 @@ Get the following from your Marketo admin:
32
32
  * hostname, i.e. `'123-abc-123.mktorest.com'`
33
33
  * client id, e.g. `'4567e1cdf-0fae-4685-a914-5be45043f2d8'`
34
34
  * client secret, e.g. `'7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt'`
35
+ * partner id, e.g. `'335b1c91511b8d8b49c7bbf66f53288f16f37b60_a0147938d3135f8ddb5a75850ea3c39313fd23c4'` (optional)
35
36
 
36
37
 
37
38
  ## Usage
@@ -42,7 +43,9 @@ Get the following from your Marketo admin:
42
43
  client = Mrkt::Client.new(
43
44
  host: '123-abc-123.mktorest.com',
44
45
  client_id: '4567e1cdf-0fae-4685-a914-5be45043f2d8',
45
- client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt')
46
+ client_secret: '7Gn0tuiHZiDHnzeu9P14uDQcSx9xIPPt',
47
+ partner_id: '335b1c91511b8d8b49c7bbf66f53288f16f37b60_a0147938d3135f8ddb5a75850ea3c39313fd23c4' # optional
48
+ )
46
49
  ```
47
50
 
48
51
  If you need verbosity during troubleshooting, enable debug mode:
data/lib/mrkt.rb CHANGED
@@ -40,6 +40,7 @@ module Mrkt
40
40
 
41
41
  @client_id = options.fetch(:client_id)
42
42
  @client_secret = options.fetch(:client_secret)
43
+ @partner_id = options[:partner_id]
43
44
 
44
45
  @retry_authentication = options.fetch(:retry_authentication, false)
45
46
  @retry_authentication_count = options.fetch(:retry_authentication_count, 3).to_i
@@ -39,15 +39,27 @@ module Mrkt
39
39
  end
40
40
 
41
41
  def authentication_params
42
+ merge_params(required_authentication_params, optional_authentication_params)
43
+ end
44
+
45
+ def add_authorization(req)
46
+ req.headers[:authorization] = "Bearer #{@token}"
47
+ end
48
+
49
+ private
50
+
51
+ def optional_authentication_params
52
+ {
53
+ partner_id: @partner_id
54
+ }
55
+ end
56
+
57
+ def required_authentication_params
42
58
  {
43
59
  grant_type: 'client_credentials',
44
60
  client_id: @client_id,
45
61
  client_secret: @client_secret
46
62
  }
47
63
  end
48
-
49
- def add_authorization(req)
50
- req.headers[:authorization] = "Bearer #{@token}"
51
- end
52
64
  end
53
65
  end
data/lib/mrkt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mrkt
2
- VERSION = '0.10.0'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
@@ -29,6 +29,44 @@ describe Mrkt::Authentication do
29
29
  expect(client.authenticated?).to be true
30
30
  end
31
31
 
32
+ context 'with optional partner_id client option' do
33
+ before { remove_request_stub(@authentication_request_stub) }
34
+
35
+ let(:partner_id) { SecureRandom.uuid }
36
+
37
+ let(:client_options) do
38
+ {
39
+ host: host,
40
+ client_id: client_id,
41
+ client_secret: client_secret,
42
+ partner_id: partner_id
43
+ }
44
+ end
45
+
46
+ let(:query) do
47
+ {
48
+ client_id: client_id,
49
+ client_secret: client_secret,
50
+ partner_id: partner_id,
51
+ grant_type: 'client_credentials'
52
+ }
53
+ end
54
+
55
+ subject(:client) { Mrkt::Client.new(client_options) }
56
+
57
+ before do
58
+ stub_request(:get, "https://#{host}/identity/oauth/token")
59
+ .with(query: query)
60
+ .to_return(json_stub(authentication_stub))
61
+ end
62
+
63
+ it 'should authenticate and then be authenticated?' do
64
+ expect(client.authenticated?).to_not be true
65
+ client.authenticate!
66
+ expect(client.authenticated?).to be true
67
+ end
68
+ end
69
+
32
70
  context 'when the token has expired and @retry_authentication = true' do
33
71
  before { remove_request_stub(@authentication_request_stub) }
34
72
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrkt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - KARASZI István
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-23 00:00:00.000000000 Z
12
+ date: 2019-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubygems_version: 3.0.3
226
+ rubygems_version: 3.0.6
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Marketo REST API Facade