tokyo_api 1.0.2 → 1.0.4

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
- SHA1:
3
- metadata.gz: ce868fc23b91acff324f8c4b76101f5036cae1de
4
- data.tar.gz: d7c838b641d90f08a622232d085068cf23ec9837
2
+ SHA256:
3
+ metadata.gz: ed8e0aec8844fbae2e781a705150e5765f07d77e1188b38dd26126d23ab0bc4b
4
+ data.tar.gz: 2abdf3a1994f21b8211798957db80c4d646c749574ab4a72b7b702c91e25c8df
5
5
  SHA512:
6
- metadata.gz: 4b4ec50c2f47c3ad260cbd81925b02f7808024d8faba17f51f27c7d0caa1be6d0fd9781d3556bbb30bfcce28e33a09fde5a2a4fdeb2db7717c6ef75a4f46b40b
7
- data.tar.gz: a4550e655cf915316a4688bd4f7e27cb96d370c21765cb6db4b0570c1b74e592672db6689272f36c7a0413030aadf77ee5ecbf7c4b0deb144e4b8f083ddc13da
6
+ metadata.gz: a7bd870c694d74083990ee7f2342e4a9f79c8928c966dff1c4529e01c71dd339629a7563f7856d57312dc29c83607b40e514dbff6d82b7291004c49602db10cf
7
+ data.tar.gz: '08be5c5193cf90e41487950837763a77bcdb5e1e186f0eddeb74f8a87caf065c478052a4c774d67a46e22caac30993b8426e765b594c6e94f2556ddeb57891bf'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.4
1
+ 2.5.1
data/Gemfile.lock CHANGED
@@ -47,13 +47,13 @@ GEM
47
47
  kamelcase (0.0.1)
48
48
  semver2 (~> 3)
49
49
  mime-types (2.99.3)
50
- mini_portile2 (2.2.0)
50
+ mini_portile2 (2.3.0)
51
51
  minitest (5.10.3)
52
52
  multi_json (1.12.1)
53
53
  multi_xml (0.6.0)
54
54
  multipart-post (2.0.0)
55
- nokogiri (1.8.0)
56
- mini_portile2 (~> 2.2.0)
55
+ nokogiri (1.8.2)
56
+ mini_portile2 (~> 2.3.0)
57
57
  oauth2 (1.4.0)
58
58
  faraday (>= 0.8, < 0.13)
59
59
  jwt (~> 1.0)
@@ -104,4 +104,4 @@ DEPENDENCIES
104
104
  webmock
105
105
 
106
106
  BUNDLED WITH
107
- 1.15.4
107
+ 1.16.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.4
@@ -16,5 +16,23 @@ module TokyoApi
16
16
  end
17
17
  path
18
18
  end
19
+
20
+ def subscription_status_path(id, opt_in_external_id: nil, opt_in_public_ids: nil, minimum_consent_level: nil)
21
+ if opt_in_public_ids.nil? && opt_in_external_id.nil?
22
+ raise 'must provide either opt_in_public_ids or opt_in_external_id'
23
+ end
24
+
25
+ if opt_in_external_id.present?
26
+ path = "/#{normalized_base_path}subscription_status/#{url_escape(id)}?opt_in_external_id=#{url_escape(opt_in_external_id)}"
27
+ else
28
+ path = "/#{normalized_base_path}subscription_status/#{url_escape(id)}?opt_in_public_ids=#{url_escape(opt_in_public_ids.join(','))}"
29
+ end
30
+
31
+ if minimum_consent_level
32
+ path = "#{path}&minimum_consent_level=#{url_escape(minimum_consent_level)}"
33
+ end
34
+
35
+ path
36
+ end
19
37
  end
20
38
  end
@@ -54,4 +54,26 @@ describe TokyoApi::Identity do
54
54
  end
55
55
  end
56
56
  end
57
+
58
+ describe '#subscription_status_path' do
59
+ it 'should raise if neither param provided' do
60
+ expect { subject.identity.subscription_status_path('abc123') }.to raise_error(RuntimeError)
61
+ end
62
+
63
+ it 'should return correct path for a list of public ids' do
64
+ expected_path = '/identity/subscription_status/abc123?opt_in_public_ids=policy-1.5%2Cpolicy-1.6'
65
+ expect(subject.identity.subscription_status_path('abc123', opt_in_public_ids: ['policy-1.5', 'policy-1.6'])).to eq expected_path
66
+ end
67
+
68
+
69
+ it 'should return correct path for a specific external id' do
70
+ expected_path = '/identity/subscription_status/abc123?opt_in_external_id=policy-1.5'
71
+ expect(subject.identity.subscription_status_path('abc123', opt_in_external_id: 'policy-1.5')).to eq expected_path
72
+ end
73
+
74
+ it 'should support minimum_consent_level' do
75
+ expected_path = '/identity/subscription_status/abc123?opt_in_external_id=policy-1.5&minimum_consent_level=explicit'
76
+ expect(subject.identity.subscription_status_path('abc123', opt_in_external_id: 'policy-1.5', minimum_consent_level: 'explicit')).to eq expected_path
77
+ end
78
+ end
57
79
  end
data/tokyo_api.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tokyo_api 1.0.2 ruby lib
5
+ # stub: tokyo_api 1.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tokyo_api".freeze
9
- s.version = "1.0.2"
9
+ s.version = "1.0.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze]
14
- s.date = "2017-09-07"
14
+ s.date = "2018-05-08"
15
15
  s.description = "Tokyo is a CRM middleware, this gem helps apps talk to it.".freeze
16
16
  s.email = "nathan@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
58
58
  ]
59
59
  s.homepage = "http://github.com/controlshift/tokyo_api".freeze
60
60
  s.licenses = ["MIT".freeze]
61
- s.rubygems_version = "2.5.2".freeze
61
+ s.rubygems_version = "2.7.6".freeze
62
62
  s.summary = "Ruby API Wrapper for Tokyo CRM service".freeze
63
63
 
64
64
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokyo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2018-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vertebrae
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.5.2
161
+ rubygems_version: 2.7.6
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Ruby API Wrapper for Tokyo CRM service