spearly-sdk-ruby 0.8.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +3 -3
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +15 -6
- data/Gemfile +2 -0
- data/lib/spearly/auth/authorizer.rb +21 -18
- data/lib/spearly/auth/client.rb +41 -25
- data/lib/spearly/auth/oauth_user.rb +4 -0
- data/lib/spearly/auth/team.rb +4 -0
- data/lib/spearly/auth/token.rb +6 -2
- data/lib/spearly/auth/user.rb +6 -2
- data/lib/spearly/cloud/client.rb +4 -2
- data/lib/spearly/version.rb +1 -1
- data/spearly.gemspec +6 -3
- data/spec/spearly/auth/client_spec.rb +90 -0
- data/spec/spec_helper.rb +2 -0
- metadata +38 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ea587fbe14cca4cebc1b12a299ee8ddaa5c64df3c50f51ff4989b1d18094990
|
4
|
+
data.tar.gz: 14e9537659004b0e52c193a4f0708407b31d2d9f77909352326351fb8f87329c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60dae3572451b45f445cd4ee7487ddeec830bc274e9dead7264a007babc6491732fb4bd1cac5e11e5caa2c2a8a5a8e5fca7f7086bd729dbe356e918113e3b16c
|
7
|
+
data.tar.gz: 94a932fdc203d988badf93296cef0fd808d08abe0856903ffc85aca5210d58f28e1d5de6bbc1cb19447696cbebca0e9c10ef3f91462684fc2d99854ca18498ce
|
data/.github/workflows/main.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
name: Ruby
|
2
|
-
on: [push
|
2
|
+
on: [push]
|
3
3
|
jobs:
|
4
4
|
build:
|
5
5
|
runs-on: ubuntu-latest
|
@@ -8,9 +8,9 @@ jobs:
|
|
8
8
|
- name: Set up Ruby
|
9
9
|
uses: ruby/setup-ruby@v1
|
10
10
|
with:
|
11
|
-
ruby-version: 2.7.
|
11
|
+
ruby-version: 2.7.7
|
12
12
|
- name: Run the default task
|
13
13
|
run: |
|
14
|
-
gem install bundler -v 2.
|
14
|
+
gem install bundler -v 2.3.26
|
15
15
|
bundle install
|
16
16
|
bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require:
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
2
3
|
AllCops:
|
3
4
|
NewCops: enable
|
4
5
|
TargetRubyVersion: 2.7
|
@@ -15,6 +16,8 @@ Metrics/ClassLength:
|
|
15
16
|
Enabled: false
|
16
17
|
Metrics/MethodLength:
|
17
18
|
Enabled: false
|
19
|
+
RSpec/BeNil:
|
20
|
+
EnforcedStyle: 'be'
|
18
21
|
RSpec/ExampleLength:
|
19
22
|
Enabled: false
|
20
23
|
RSpec/MessageSpies:
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
|
+
## [0.10.0] - 2022-12-05
|
2
|
+
|
3
|
+
- `Spearly::Auth::Client#get_team_subscriptions()`
|
4
|
+
|
5
|
+
## [0.9.0] - 2022-12-05
|
6
|
+
|
7
|
+
- Return `errors` object on `Spearly::Auth::Client#create_team()`'s 422 responses
|
8
|
+
|
1
9
|
## [0.8.0] - 2022-06-15
|
2
10
|
|
3
|
-
- `Spearly::Auth::Client#get_user`
|
11
|
+
- `Spearly::Auth::Client#get_user()`
|
4
12
|
|
5
13
|
## [0.7.0] - 2022-01-31
|
6
14
|
|
7
|
-
- `Spearly::Cloud::Client#get_site`
|
8
|
-
- `Spearly::Cloud::Client#get_sites`
|
15
|
+
- `Spearly::Cloud::Client#get_site()`
|
16
|
+
- `Spearly::Cloud::Client#get_sites()`
|
9
17
|
|
10
18
|
## [0.6.0] - 2022-01-20
|
11
19
|
|
12
|
-
- `Spearly::Auth::Client#get_team_features`
|
20
|
+
- `Spearly::Auth::Client#get_team_features()`
|
13
21
|
|
14
22
|
## [0.5.0] - 2021-12-13
|
15
23
|
|
@@ -22,7 +30,7 @@
|
|
22
30
|
## [0.3.2] - 2021-09-13
|
23
31
|
|
24
32
|
- Use the new `Spearly API v2`
|
25
|
-
-
|
33
|
+
- Refactor parsing `JSON` data
|
26
34
|
|
27
35
|
## [0.2.4] - 2021-07-16
|
28
36
|
|
@@ -34,10 +42,11 @@
|
|
34
42
|
|
35
43
|
## [0.2.2] - 2021-06-11
|
36
44
|
|
37
|
-
-
|
45
|
+
- Update `README` and gem specs
|
38
46
|
|
39
47
|
## [0.2.1] - 2021-05-31
|
40
48
|
|
49
|
+
|
41
50
|
- Initialize `Spearly::Auth::User` with bearer token
|
42
51
|
|
43
52
|
## [0.2.0] - 2021-05-31
|
data/Gemfile
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'signet/oauth_2/client'
|
4
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
4
5
|
|
5
6
|
module Spearly
|
6
7
|
module Auth
|
7
8
|
class Authorizer
|
8
9
|
def initialize(params)
|
9
|
-
@params = params
|
10
|
+
@params = params.deep_symbolize_keys
|
10
11
|
@client = initialize_client
|
11
12
|
end
|
12
13
|
|
@@ -16,6 +17,10 @@ module Spearly
|
|
16
17
|
raise Spearly::Auth::AuthorizationError
|
17
18
|
end
|
18
19
|
|
20
|
+
def respond_to_missing?(_name, *_args)
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
19
24
|
private
|
20
25
|
|
21
26
|
def initialize_client
|
@@ -25,23 +30,21 @@ module Spearly
|
|
25
30
|
}
|
26
31
|
}
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
client
|
33
|
+
::Signet::OAuth2::Client.new(
|
34
|
+
client_id: @params[:client_id],
|
35
|
+
client_secret: @params[:client_secret],
|
36
|
+
code: @params[:code],
|
37
|
+
grant_type: @params[:grant_type],
|
38
|
+
authorization_uri: "#{ENV.fetch('SPEARLY_API_URL', nil)}/oauth/authorize",
|
39
|
+
token_credential_uri: "#{ENV.fetch('SPEARLY_API_URL', nil)}/oauth/token",
|
40
|
+
redirect_uri: @params[:redirect_uri],
|
41
|
+
access_token: @params[:access_token],
|
42
|
+
refresh_token: @params[:refresh_token],
|
43
|
+
id_token: @params[:id_token],
|
44
|
+
expires_in: @params[:expires_in],
|
45
|
+
issued_at: @params[:issued_at],
|
46
|
+
expires_at: @params[:expires_at]
|
47
|
+
)
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
data/lib/spearly/auth/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Spearly
|
2
4
|
module Auth
|
3
5
|
class Client
|
@@ -6,7 +8,7 @@ module Spearly
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def get_user(user_id)
|
9
|
-
uri = "#{ENV
|
11
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/users/#{user_id}"
|
10
12
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
11
13
|
client = Faraday.default_connection
|
12
14
|
|
@@ -23,7 +25,7 @@ module Spearly
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def create_team(params)
|
26
|
-
uri = "#{ENV
|
28
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams"
|
27
29
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
28
30
|
client = Faraday.default_connection
|
29
31
|
|
@@ -32,15 +34,18 @@ module Spearly
|
|
32
34
|
'Accept' => 'application/vnd.spearly.v2+json',
|
33
35
|
'Authorization' => @token)
|
34
36
|
|
35
|
-
|
37
|
+
case res.status
|
38
|
+
when 201
|
36
39
|
JSON.parse(res.body)['data']
|
40
|
+
when 422
|
41
|
+
JSON.parse(res.body)
|
37
42
|
else
|
38
43
|
{}
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
42
47
|
def get_team(team_id)
|
43
|
-
uri = "#{ENV
|
48
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}"
|
44
49
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
45
50
|
client = Faraday.default_connection
|
46
51
|
|
@@ -57,7 +62,7 @@ module Spearly
|
|
57
62
|
end
|
58
63
|
|
59
64
|
def get_teams(params = {})
|
60
|
-
uri = "#{ENV
|
65
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams"
|
61
66
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
62
67
|
client = Faraday.default_connection
|
63
68
|
|
@@ -74,7 +79,7 @@ module Spearly
|
|
74
79
|
end
|
75
80
|
|
76
81
|
def update_team(team_id, params)
|
77
|
-
uri = "#{ENV
|
82
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}"
|
78
83
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
79
84
|
client = Faraday.default_connection
|
80
85
|
|
@@ -83,15 +88,13 @@ module Spearly
|
|
83
88
|
'Accept' => 'application/vnd.spearly.v2+json',
|
84
89
|
'Authorization' => @token)
|
85
90
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
nil
|
90
|
-
end
|
91
|
+
return unless res.status == 200
|
92
|
+
|
93
|
+
JSON.parse(res.body)['data']
|
91
94
|
end
|
92
95
|
|
93
96
|
def regenerate_team_api_access_token(team_id)
|
94
|
-
uri = "#{ENV
|
97
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/regenerate_api_access_token"
|
95
98
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
96
99
|
client = Faraday.default_connection
|
97
100
|
|
@@ -100,15 +103,13 @@ module Spearly
|
|
100
103
|
'Accept' => 'application/vnd.spearly.v2+json',
|
101
104
|
'Authorization' => @token)
|
102
105
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
nil
|
107
|
-
end
|
106
|
+
return unless res.status == 200
|
107
|
+
|
108
|
+
JSON.parse(res.body)['data']
|
108
109
|
end
|
109
110
|
|
110
111
|
def invite_user_to_team(team_id, params)
|
111
|
-
uri = "#{ENV
|
112
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/invite"
|
112
113
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
113
114
|
client = Faraday.default_connection
|
114
115
|
|
@@ -117,15 +118,13 @@ module Spearly
|
|
117
118
|
'Accept' => 'application/vnd.spearly.v2+json',
|
118
119
|
'Authorization' => @token)
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
nil
|
124
|
-
end
|
121
|
+
return unless res.status == 201
|
122
|
+
|
123
|
+
JSON.parse(res.body)['data']
|
125
124
|
end
|
126
125
|
|
127
126
|
def get_team_members(team_id)
|
128
|
-
uri = "#{ENV
|
127
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/members"
|
129
128
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
130
129
|
client = Faraday.default_connection
|
131
130
|
|
@@ -142,7 +141,7 @@ module Spearly
|
|
142
141
|
end
|
143
142
|
|
144
143
|
def get_team_features(team_id)
|
145
|
-
uri = "#{ENV
|
144
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/features"
|
146
145
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
147
146
|
client = Faraday.default_connection
|
148
147
|
|
@@ -157,6 +156,23 @@ module Spearly
|
|
157
156
|
{}
|
158
157
|
end
|
159
158
|
end
|
159
|
+
|
160
|
+
def get_team_subscriptions(team_id, params)
|
161
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/subscriptions"
|
162
|
+
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
163
|
+
client = Faraday.default_connection
|
164
|
+
|
165
|
+
res = client.get(uri_parsed,
|
166
|
+
params.as_json,
|
167
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
168
|
+
'Authorization' => @token)
|
169
|
+
|
170
|
+
if res.status == 200
|
171
|
+
JSON.parse(res.body)
|
172
|
+
else
|
173
|
+
[]
|
174
|
+
end
|
175
|
+
end
|
160
176
|
end
|
161
177
|
end
|
162
178
|
end
|
data/lib/spearly/auth/team.rb
CHANGED
data/lib/spearly/auth/token.rb
CHANGED
@@ -16,8 +16,12 @@ module Spearly
|
|
16
16
|
@data[name.to_s]
|
17
17
|
end
|
18
18
|
|
19
|
+
def respond_to_missing?(_name, *_args)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
19
23
|
def info
|
20
|
-
token_info_uri = "#{ENV
|
24
|
+
token_info_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/oauth/token/info"
|
21
25
|
url = Addressable::URI.parse(token_info_uri).normalize.to_s
|
22
26
|
client = Faraday.default_connection
|
23
27
|
|
@@ -32,7 +36,7 @@ module Spearly
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def revoke(params)
|
35
|
-
token_revoke_uri = "#{ENV
|
39
|
+
token_revoke_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/oauth/revoke"
|
36
40
|
url = Addressable::URI.parse(token_revoke_uri).normalize.to_s
|
37
41
|
client = Faraday.default_connection
|
38
42
|
|
data/lib/spearly/auth/user.rb
CHANGED
@@ -16,8 +16,12 @@ module Spearly
|
|
16
16
|
@data[name.to_s]
|
17
17
|
end
|
18
18
|
|
19
|
+
def respond_to_missing?(_name, *_args)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
19
23
|
def find
|
20
|
-
user_profile_uri = "#{ENV
|
24
|
+
user_profile_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/profile"
|
21
25
|
url = Addressable::URI.parse(user_profile_uri).normalize.to_s
|
22
26
|
client = Faraday.default_connection
|
23
27
|
|
@@ -32,7 +36,7 @@ module Spearly
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def teams
|
35
|
-
teams_uri = "#{ENV
|
39
|
+
teams_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams"
|
36
40
|
url = Addressable::URI.parse(teams_uri).normalize.to_s
|
37
41
|
client = Faraday.default_connection
|
38
42
|
|
data/lib/spearly/cloud/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Spearly
|
2
4
|
module Cloud
|
3
5
|
class Client
|
@@ -6,7 +8,7 @@ module Spearly
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def get_sites(params = {})
|
9
|
-
uri = "#{ENV
|
11
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/sites"
|
10
12
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
11
13
|
client = Faraday.default_connection
|
12
14
|
|
@@ -23,7 +25,7 @@ module Spearly
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def get_site(site_id)
|
26
|
-
uri = "#{ENV
|
28
|
+
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/sites/#{site_id}"
|
27
29
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
28
30
|
client = Faraday.default_connection
|
29
31
|
|
data/lib/spearly/version.rb
CHANGED
data/spearly.gemspec
CHANGED
@@ -10,10 +10,11 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.summary = 'Spearly SDK for Ruby'
|
12
12
|
gem.homepage = 'https://github.com/unimal-jp/spearly-sdk-ruby'
|
13
|
-
gem.required_ruby_version = Gem::Requirement.new('>= 2.7.
|
13
|
+
gem.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
14
14
|
gem.metadata['homepage_uri'] = gem.homepage
|
15
15
|
gem.metadata['source_code_uri'] = 'https://github.com/unimal-jp/spearly-sdk-ruby'
|
16
16
|
gem.metadata['changelog_uri'] = "https://github.com/unimal-jp/spearly-sdk-ruby/blob/v#{Spearly::VERSION}/CHANGELOG.md"
|
17
|
+
gem.metadata['rubygems_mfa_required'] = 'true'
|
17
18
|
|
18
19
|
gem.files = `git ls-files`.split("\n")
|
19
20
|
gem.executables = 'spearly'
|
@@ -25,8 +26,10 @@ Gem::Specification.new do |gem|
|
|
25
26
|
gem.add_runtime_dependency 'faraday', '>= 0.17.4', '< 2.0'
|
26
27
|
gem.add_runtime_dependency 'signet', '~> 0.15'
|
27
28
|
|
28
|
-
gem.add_development_dependency '
|
29
|
-
gem.add_development_dependency '
|
29
|
+
gem.add_development_dependency 'bundler-audit', '~> 0.9'
|
30
|
+
gem.add_development_dependency 'fuubar', '~> 2.5'
|
31
|
+
gem.add_development_dependency 'pry', '~> 0.13'
|
32
|
+
gem.add_development_dependency 'rspec', '~> 3.10'
|
30
33
|
gem.add_development_dependency 'rubocop', '~> 1.15'
|
31
34
|
gem.add_development_dependency 'rubocop-rspec', '~> 2.3'
|
32
35
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Spearly::Auth::Client do
|
6
|
+
let!(:connection_double) { instance_double(Faraday::Connection) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
stub_const('ENV', { 'SPEARLY_API_URL' => 'https://api.spearly.test' })
|
10
|
+
|
11
|
+
allow(Faraday).to receive(:default_connection).and_return(connection_double)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.create_team()' do
|
15
|
+
let!(:response_double) { instance_double(Faraday::Response, status: 201, body: { 'data' => { 'id' => '711' } }.to_json) }
|
16
|
+
let!(:params) { { hey: 'jude' } }
|
17
|
+
let!(:client) { described_class.new('token') }
|
18
|
+
|
19
|
+
before do
|
20
|
+
allow(connection_double).to receive(:post).and_return(response_double)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'makes POST request to /teams' do
|
24
|
+
uri_parsed = Addressable::URI.parse('https://api.spearly.test/teams').normalize.to_s
|
25
|
+
|
26
|
+
expect(connection_double).to receive(:post).with(uri_parsed,
|
27
|
+
params.as_json,
|
28
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
29
|
+
'Authorization' => 'token')
|
30
|
+
|
31
|
+
described_class.new('token')
|
32
|
+
.create_team(params)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns data object if status is 201' do
|
36
|
+
res = client.create_team(params)
|
37
|
+
|
38
|
+
expect(res).to eq('id' => '711')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns errors object if status is 422' do
|
42
|
+
response_double = instance_double(Faraday::Response, status: 422, body: { 'errors' => { 'owner' => ["can't own more than 2 free teams"] } }.to_json)
|
43
|
+
|
44
|
+
allow(connection_double).to receive(:post).and_return(response_double)
|
45
|
+
|
46
|
+
res = client.create_team(params)
|
47
|
+
|
48
|
+
expect(res['errors']).to eq('owner' => ["can't own more than 2 free teams"])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '.get_team_subscriptions()' do
|
53
|
+
let!(:response_double) { instance_double(Faraday::Response, status: 200, body: { 'data' => [{ 'id' => 'sub_1' }] }.to_json) }
|
54
|
+
let!(:team_id) { '711' }
|
55
|
+
let!(:params) { { service_name: 'cms' } }
|
56
|
+
let!(:client) { described_class.new('token') }
|
57
|
+
|
58
|
+
before do
|
59
|
+
allow(connection_double).to receive(:get).and_return(response_double)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'makes GET request to /teams/{team_id}/subscriptions' do
|
63
|
+
uri_parsed = Addressable::URI.parse('https://api.spearly.test/teams/711/subscriptions').normalize.to_s
|
64
|
+
|
65
|
+
expect(connection_double).to receive(:get).with(uri_parsed,
|
66
|
+
params.as_json,
|
67
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
68
|
+
'Authorization' => 'token')
|
69
|
+
|
70
|
+
described_class.new('token')
|
71
|
+
.get_team_subscriptions(team_id, params)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'returns data object if status is 200' do
|
75
|
+
res = client.get_team_subscriptions(team_id, params)
|
76
|
+
|
77
|
+
expect(res).to eq('data' => [{ 'id' => 'sub_1' }])
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'returns empty array if status is not 200' do
|
81
|
+
response_double = instance_double(Faraday::Response, status: 404)
|
82
|
+
|
83
|
+
allow(connection_double).to receive(:get).and_return(response_double)
|
84
|
+
|
85
|
+
res = client.get_team_subscriptions(team_id, params)
|
86
|
+
|
87
|
+
expect(res).to eq []
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spearly-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spearly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -72,34 +72,62 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.15'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: bundler-audit
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.9'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.9'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: fuubar
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.5'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.5'
|
75
103
|
- !ruby/object:Gem::Dependency
|
76
104
|
name: pry
|
77
105
|
requirement: !ruby/object:Gem::Requirement
|
78
106
|
requirements:
|
79
107
|
- - "~>"
|
80
108
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.13
|
109
|
+
version: '0.13'
|
82
110
|
type: :development
|
83
111
|
prerelease: false
|
84
112
|
version_requirements: !ruby/object:Gem::Requirement
|
85
113
|
requirements:
|
86
114
|
- - "~>"
|
87
115
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.13
|
116
|
+
version: '0.13'
|
89
117
|
- !ruby/object:Gem::Dependency
|
90
118
|
name: rspec
|
91
119
|
requirement: !ruby/object:Gem::Requirement
|
92
120
|
requirements:
|
93
121
|
- - "~>"
|
94
122
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
123
|
+
version: '3.10'
|
96
124
|
type: :development
|
97
125
|
prerelease: false
|
98
126
|
version_requirements: !ruby/object:Gem::Requirement
|
99
127
|
requirements:
|
100
128
|
- - "~>"
|
101
129
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
130
|
+
version: '3.10'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
132
|
name: rubocop
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +189,7 @@ files:
|
|
161
189
|
- lib/spearly/cloud/client.rb
|
162
190
|
- lib/spearly/version.rb
|
163
191
|
- spearly.gemspec
|
192
|
+
- spec/spearly/auth/client_spec.rb
|
164
193
|
- spec/spearly_spec.rb
|
165
194
|
- spec/spec_helper.rb
|
166
195
|
homepage: https://github.com/unimal-jp/spearly-sdk-ruby
|
@@ -168,7 +197,8 @@ licenses: []
|
|
168
197
|
metadata:
|
169
198
|
homepage_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
170
199
|
source_code_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
171
|
-
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.
|
200
|
+
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.10.0/CHANGELOG.md
|
201
|
+
rubygems_mfa_required: 'true'
|
172
202
|
post_install_message:
|
173
203
|
rdoc_options: []
|
174
204
|
require_paths:
|
@@ -177,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
207
|
requirements:
|
178
208
|
- - ">="
|
179
209
|
- !ruby/object:Gem::Version
|
180
|
-
version: 2.7.
|
210
|
+
version: 2.7.0
|
181
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
212
|
requirements:
|
183
213
|
- - ">="
|