spearly-sdk-ruby 0.9.0 → 0.11.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 +11 -6
- data/.rubocop.yml +3 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile +8 -1
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/lib/spearly/auth/authorizer.rb +0 -1
- data/lib/spearly/auth/client.rb +34 -142
- data/lib/spearly/auth/team.rb +43 -12
- data/lib/spearly/auth/team_member.rb +28 -0
- data/lib/spearly/auth/team_subscription.rb +18 -0
- data/lib/spearly/auth/token.rb +18 -50
- data/lib/spearly/auth/user.rb +17 -55
- data/lib/spearly/auth.rb +2 -9
- data/lib/spearly/cloud/client.rb +2 -2
- data/lib/spearly/version.rb +1 -1
- data/spearly.gemspec +1 -8
- data/spec/spearly/auth/client_spec.rb +6 -35
- data/spec/spearly/auth/team_member_spec.rb +159 -0
- data/spec/spearly/auth/team_spec.rb +371 -0
- data/spec/spearly/auth/team_subscription_spec.rb +82 -0
- data/spec/spearly/auth/token_spec.rb +150 -0
- data/spec/spearly/auth/user_spec.rb +168 -0
- data/spec/spec_helper.rb +0 -1
- metadata +12 -92
- data/lib/spearly/auth/engine.rb +0 -13
- data/lib/spearly/auth/oauth_user.rb +0 -32
- data/lib/spearly/auth/rails/helpers.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7a126a7094bd795601cf10607c883663aa23b5a2d28cd55eb5752846388d9af
|
4
|
+
data.tar.gz: 4747ed60ef82ac5bf58291251b4b6e7cee8c2e63ca6f1bf54006ba72b7a27e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f12204d316b86497f18ee26bd1e5241a2810200a262e757c5d15056a7fb4fe3a436622a2d766bd769f5e53169f0120ab89d5559ca9caa3bae368ca37156bb55
|
7
|
+
data.tar.gz: a1014c15b5030ebd1326e6742c29d913bba91d6a554d0bbd94e8fe7857c4a41fa7a7916e368fc5a71948ba7b9b07233f42a61bf13424920cea650a4e699b26b5
|
data/.github/workflows/main.yml
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
name: Ruby
|
2
|
-
on:
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- '**'
|
3
6
|
jobs:
|
4
7
|
build:
|
5
|
-
runs-on: ubuntu-
|
8
|
+
runs-on: ubuntu-22.04
|
6
9
|
steps:
|
7
|
-
-
|
8
|
-
|
10
|
+
- name: Checkout code
|
11
|
+
uses: actions/checkout@v3
|
12
|
+
|
13
|
+
- name: Setup Ruby
|
9
14
|
uses: ruby/setup-ruby@v1
|
10
15
|
with:
|
11
|
-
ruby-version:
|
16
|
+
ruby-version: 3.1.4
|
17
|
+
|
12
18
|
- name: Run the default task
|
13
19
|
run: |
|
14
|
-
gem install bundler -v 2.3.26
|
15
20
|
bundle install
|
16
21
|
bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ require:
|
|
2
2
|
- rubocop-rspec
|
3
3
|
AllCops:
|
4
4
|
NewCops: enable
|
5
|
-
TargetRubyVersion:
|
5
|
+
TargetRubyVersion: 3.1
|
6
6
|
Exclude:
|
7
7
|
- 'bin/**/*'
|
8
8
|
Layout/EmptyLineBetweenDefs:
|
@@ -16,6 +16,8 @@ Metrics/ClassLength:
|
|
16
16
|
Enabled: false
|
17
17
|
Metrics/MethodLength:
|
18
18
|
Enabled: false
|
19
|
+
Naming/AccessorMethodName:
|
20
|
+
Enabled: false
|
19
21
|
RSpec/BeNil:
|
20
22
|
EnforcedStyle: 'be'
|
21
23
|
RSpec/ExampleLength:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## [0.11.0] - 2023-09-23
|
2
|
+
|
3
|
+
- Throw errors `from Spearly::Auth` methods #15
|
4
|
+
- `Spearly::Auth::Client` refactors #14
|
5
|
+
- Upgrade Ruby to 3.1.4 #13
|
6
|
+
- Remove deprecated classes and helpers #12
|
7
|
+
|
8
|
+
## [0.10.0] - 2022-12-05
|
9
|
+
|
10
|
+
- `Spearly::Auth::Client#get_team_subscriptions()`
|
11
|
+
|
1
12
|
## [0.9.0] - 2022-12-05
|
2
13
|
|
3
14
|
- Return `errors` object on `Spearly::Auth::Client#create_team()`'s 422 responses
|
data/Gemfile
CHANGED
@@ -3,4 +3,11 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
6
|
+
group :development do
|
7
|
+
gem 'bundler-audit', '~> 0.9'
|
8
|
+
gem 'fuubar', '~> 2.5'
|
9
|
+
gem 'pry', '~> 0.13'
|
10
|
+
gem 'rspec', '~> 3.10'
|
11
|
+
gem 'rubocop', '~> 1.15'
|
12
|
+
gem 'rubocop-rspec', '~> 2.3'
|
13
|
+
end
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/spearly/auth/client.rb
CHANGED
@@ -1,159 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'team_member'
|
4
|
+
require_relative 'team_subscription'
|
5
|
+
require_relative 'team'
|
6
|
+
require_relative 'token'
|
7
|
+
require_relative 'user'
|
8
|
+
|
3
9
|
module Spearly
|
4
10
|
module Auth
|
5
11
|
class Client
|
12
|
+
include Team
|
13
|
+
include TeamMember
|
14
|
+
include TeamSubscription
|
15
|
+
include Token
|
16
|
+
include User
|
17
|
+
|
6
18
|
def initialize(token)
|
7
19
|
@token = token
|
8
|
-
end
|
9
20
|
|
10
|
-
|
11
|
-
|
12
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
13
|
-
client = Faraday.default_connection
|
14
|
-
|
15
|
-
res = client.get(uri_parsed,
|
16
|
-
nil,
|
17
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
18
|
-
'Authorization' => @token)
|
19
|
-
|
20
|
-
if res.status == 200
|
21
|
-
JSON.parse(res.body)['data']
|
22
|
-
else
|
23
|
-
{}
|
24
|
-
end
|
21
|
+
base_url = ENV.fetch('SPEARLY_API_URL', nil)
|
22
|
+
@client = Faraday.new(base_url)
|
25
23
|
end
|
26
24
|
|
27
|
-
def
|
28
|
-
|
29
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
30
|
-
client = Faraday.default_connection
|
31
|
-
|
32
|
-
res = client.post(uri_parsed,
|
33
|
-
params.as_json,
|
34
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
35
|
-
'Authorization' => @token)
|
25
|
+
def run_request(method:, path:, params: nil)
|
26
|
+
path_parsed = Addressable::URI.parse(path).normalize.to_s
|
36
27
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
28
|
+
@client.run_request(method.to_sym,
|
29
|
+
path_parsed,
|
30
|
+
params,
|
31
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
32
|
+
'Authorization' => @token)
|
33
|
+
rescue Faraday::ConnectionFailed => e
|
34
|
+
raise ServerError, e.message
|
45
35
|
end
|
46
36
|
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if res.status == 200
|
58
|
-
JSON.parse(res.body)['data']
|
59
|
-
else
|
60
|
-
{}
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def get_teams(params = {})
|
65
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams"
|
66
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
67
|
-
client = Faraday.default_connection
|
68
|
-
|
69
|
-
res = client.get(uri_parsed,
|
70
|
-
params.as_json,
|
71
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
72
|
-
'Authorization' => @token)
|
73
|
-
|
74
|
-
if res.status == 200
|
75
|
-
JSON.parse(res.body)['data']
|
76
|
-
else
|
77
|
-
[]
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def update_team(team_id, params)
|
82
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}"
|
83
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
84
|
-
client = Faraday.default_connection
|
85
|
-
|
86
|
-
res = client.put(uri_parsed,
|
87
|
-
params.as_json,
|
88
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
89
|
-
'Authorization' => @token)
|
90
|
-
|
91
|
-
return unless res.status == 200
|
92
|
-
|
93
|
-
JSON.parse(res.body)['data']
|
94
|
-
end
|
95
|
-
|
96
|
-
def regenerate_team_api_access_token(team_id)
|
97
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/regenerate_api_access_token"
|
98
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
99
|
-
client = Faraday.default_connection
|
100
|
-
|
101
|
-
res = client.post(uri_parsed,
|
102
|
-
nil,
|
103
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
104
|
-
'Authorization' => @token)
|
105
|
-
|
106
|
-
return unless res.status == 200
|
107
|
-
|
108
|
-
JSON.parse(res.body)['data']
|
109
|
-
end
|
110
|
-
|
111
|
-
def invite_user_to_team(team_id, params)
|
112
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/invite"
|
113
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
114
|
-
client = Faraday.default_connection
|
115
|
-
|
116
|
-
res = client.post(uri_parsed,
|
117
|
-
params.as_json,
|
118
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
119
|
-
'Authorization' => @token)
|
120
|
-
|
121
|
-
return unless res.status == 201
|
122
|
-
|
123
|
-
JSON.parse(res.body)['data']
|
124
|
-
end
|
125
|
-
|
126
|
-
def get_team_members(team_id)
|
127
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/members"
|
128
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
129
|
-
client = Faraday.default_connection
|
130
|
-
|
131
|
-
res = client.get(uri_parsed,
|
132
|
-
nil,
|
133
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
134
|
-
'Authorization' => @token)
|
135
|
-
|
136
|
-
if res.status == 200
|
137
|
-
JSON.parse(res.body)['data']
|
138
|
-
else
|
139
|
-
[]
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def get_team_features(team_id)
|
144
|
-
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/teams/#{team_id}/features"
|
145
|
-
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
146
|
-
client = Faraday.default_connection
|
147
|
-
|
148
|
-
res = client.get(uri_parsed,
|
149
|
-
nil,
|
150
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
151
|
-
'Authorization' => @token)
|
152
|
-
|
153
|
-
if res.status == 200
|
154
|
-
JSON.parse(res.body)['data']
|
37
|
+
def process_response(response)
|
38
|
+
case response.status
|
39
|
+
when 200, 201, 422
|
40
|
+
JSON.parse(response.body)
|
41
|
+
when 401
|
42
|
+
raise AuthorizationError, 'Unauthorized'
|
43
|
+
when 404
|
44
|
+
raise NotFoundError, 'Not Found'
|
45
|
+
when 503
|
46
|
+
raise ServiceUnavailableError, 'Service Unavailable'
|
155
47
|
else
|
156
|
-
|
48
|
+
raise ServerError, 'Server Error'
|
157
49
|
end
|
158
50
|
end
|
159
51
|
end
|
data/lib/spearly/auth/team.rb
CHANGED
@@ -2,27 +2,58 @@
|
|
2
2
|
|
3
3
|
module Spearly
|
4
4
|
module Auth
|
5
|
-
|
6
|
-
|
5
|
+
module Team
|
6
|
+
# POST /teams
|
7
|
+
def create_team(params)
|
8
|
+
response = run_request(
|
9
|
+
:method => :post,
|
10
|
+
path: '/teams',
|
11
|
+
params: params
|
12
|
+
)
|
7
13
|
|
8
|
-
|
9
|
-
@data = data
|
14
|
+
process_response(response)
|
10
15
|
end
|
11
16
|
|
12
|
-
|
13
|
-
|
17
|
+
# GET /teams/:team_id
|
18
|
+
def get_team(team_id)
|
19
|
+
response = run_request(
|
20
|
+
:method => :get,
|
21
|
+
path: "/teams/#{team_id}"
|
22
|
+
)
|
23
|
+
|
24
|
+
process_response(response)
|
14
25
|
end
|
15
26
|
|
16
|
-
|
17
|
-
|
27
|
+
# GET /teams
|
28
|
+
def get_teams(params)
|
29
|
+
response = run_request(
|
30
|
+
:method => :get,
|
31
|
+
path: '/teams',
|
32
|
+
params: params
|
33
|
+
)
|
34
|
+
|
35
|
+
process_response(response)
|
18
36
|
end
|
19
37
|
|
20
|
-
|
21
|
-
|
38
|
+
# PUT /teams/:team_id
|
39
|
+
def update_team(team_id, params)
|
40
|
+
response = run_request(
|
41
|
+
:method => :put,
|
42
|
+
path: "/teams/#{team_id}",
|
43
|
+
params: params
|
44
|
+
)
|
45
|
+
|
46
|
+
process_response(response)
|
22
47
|
end
|
23
48
|
|
24
|
-
|
25
|
-
|
49
|
+
# GET /teams/:team_id/regenerate_api_access_token
|
50
|
+
def regenerate_team_api_access_token(team_id)
|
51
|
+
response = run_request(
|
52
|
+
:method => :get,
|
53
|
+
path: "/teams/#{team_id}/regenerate_api_access_token"
|
54
|
+
)
|
55
|
+
|
56
|
+
process_response(response)
|
26
57
|
end
|
27
58
|
end
|
28
59
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spearly
|
4
|
+
module Auth
|
5
|
+
module TeamMember
|
6
|
+
# POST /teams/:team_id/invite
|
7
|
+
def invite_user_to_team(team_id, params)
|
8
|
+
response = run_request(
|
9
|
+
:method => :post,
|
10
|
+
path: "/teams/#{team_id}/invite",
|
11
|
+
params: params
|
12
|
+
)
|
13
|
+
|
14
|
+
process_response(response)
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /teams/:team_id/members
|
18
|
+
def get_team_members(team_id)
|
19
|
+
response = run_request(
|
20
|
+
:method => :get,
|
21
|
+
path: "/teams/#{team_id}/members"
|
22
|
+
)
|
23
|
+
|
24
|
+
process_response(response)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spearly
|
4
|
+
module Auth
|
5
|
+
module TeamSubscription
|
6
|
+
# GET /teams/:team_id/subscriptions
|
7
|
+
def get_team_subscriptions(team_id, params)
|
8
|
+
response = run_request(
|
9
|
+
:method => :get,
|
10
|
+
path: "/teams/#{team_id}/subscriptions",
|
11
|
+
params: params
|
12
|
+
)
|
13
|
+
|
14
|
+
process_response(response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/spearly/auth/token.rb
CHANGED
@@ -1,61 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'addressable/uri'
|
4
|
-
require 'faraday'
|
5
|
-
|
6
3
|
module Spearly
|
7
4
|
module Auth
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
module Token
|
6
|
+
# GET /oauth/token/info
|
7
|
+
def get_token_info
|
8
|
+
response = run_request(
|
9
|
+
:method => :get,
|
10
|
+
path: '/oauth/token/info'
|
11
|
+
)
|
12
|
+
|
13
|
+
process_response(response)
|
17
14
|
end
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
def info
|
24
|
-
token_info_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/oauth/token/info"
|
25
|
-
url = Addressable::URI.parse(token_info_uri).normalize.to_s
|
26
|
-
client = Faraday.default_connection
|
27
|
-
|
28
|
-
res = client.get(url,
|
29
|
-
nil,
|
30
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
31
|
-
'Authorization' => @token)
|
32
|
-
|
33
|
-
return unless res.status == 200
|
16
|
+
# POST /oauth/revoke
|
17
|
+
def revoke_token(params)
|
18
|
+
params[:token] = @token.gsub(/^Bearer /i, '')
|
34
19
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
url = Addressable::URI.parse(token_revoke_uri).normalize.to_s
|
41
|
-
client = Faraday.default_connection
|
42
|
-
|
43
|
-
bearer_token = @token.gsub(/^Bearer /i, '')
|
44
|
-
|
45
|
-
client.post(url,
|
46
|
-
{
|
47
|
-
client_id: params[:client_id],
|
48
|
-
client_secret: params[:client_secret],
|
49
|
-
token: bearer_token
|
50
|
-
})
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_json(*_args)
|
54
|
-
@data.to_json
|
55
|
-
end
|
20
|
+
response = run_request(
|
21
|
+
:method => :post,
|
22
|
+
path: '/oauth/revoke',
|
23
|
+
params: params
|
24
|
+
)
|
56
25
|
|
57
|
-
|
58
|
-
@data.as_json
|
26
|
+
process_response(response)
|
59
27
|
end
|
60
28
|
end
|
61
29
|
end
|
data/lib/spearly/auth/user.rb
CHANGED
@@ -1,65 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'addressable/uri'
|
4
|
-
require 'faraday'
|
5
|
-
|
6
3
|
module Spearly
|
7
4
|
module Auth
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def respond_to_missing?(_name, *_args)
|
20
|
-
true
|
21
|
-
end
|
22
|
-
|
23
|
-
def find
|
24
|
-
user_profile_uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/profile"
|
25
|
-
url = Addressable::URI.parse(user_profile_uri).normalize.to_s
|
26
|
-
client = Faraday.default_connection
|
27
|
-
|
28
|
-
res = client.get(url,
|
29
|
-
nil,
|
30
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
31
|
-
'Authorization' => @token)
|
32
|
-
|
33
|
-
return unless res.status == 200
|
34
|
-
|
35
|
-
@data = JSON.parse(res.body)['data']
|
5
|
+
module User
|
6
|
+
# GET /users/:user_id
|
7
|
+
# requires SPEARLY_API_ACCESS_TOKEN as token
|
8
|
+
def get_user(user_id)
|
9
|
+
response = run_request(
|
10
|
+
:method => :get,
|
11
|
+
path: "/users/#{user_id}"
|
12
|
+
)
|
13
|
+
|
14
|
+
process_response(response)
|
36
15
|
end
|
37
16
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
nil,
|
45
|
-
'Accept' => 'application/vnd.spearly.v2+json',
|
46
|
-
'Authorization' => @token)
|
47
|
-
|
48
|
-
return [] unless res.status == 200
|
49
|
-
|
50
|
-
team_hashes = JSON.parse(res.body)['data']
|
51
|
-
|
52
|
-
team_hashes.map do |team_hash|
|
53
|
-
Spearly::Auth::Team.new(team_hash)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def to_json(*_args)
|
58
|
-
@data.to_json
|
59
|
-
end
|
17
|
+
# GET /profile
|
18
|
+
def get_profile
|
19
|
+
response = run_request(
|
20
|
+
:method => :get,
|
21
|
+
path: '/profile'
|
22
|
+
)
|
60
23
|
|
61
|
-
|
62
|
-
@data.as_json
|
24
|
+
process_response(response)
|
63
25
|
end
|
64
26
|
end
|
65
27
|
end
|
data/lib/spearly/auth.rb
CHANGED
@@ -2,20 +2,13 @@
|
|
2
2
|
|
3
3
|
require_relative 'auth/authorizer'
|
4
4
|
require_relative 'auth/client'
|
5
|
-
require_relative 'auth/engine'
|
6
|
-
require_relative 'auth/oauth_user'
|
7
|
-
require_relative 'auth/team'
|
8
|
-
require_relative 'auth/token'
|
9
|
-
require_relative 'auth/user'
|
10
5
|
|
11
6
|
module Spearly
|
12
7
|
module Auth
|
13
8
|
class Error < StandardError; end
|
14
9
|
class AuthorizationError < Error; end
|
10
|
+
class NotFoundError < Error; end
|
15
11
|
class ServerError < Error; end
|
16
|
-
|
17
|
-
module Rails
|
18
|
-
autoload :Helpers, 'spearly/auth/rails/helpers'
|
19
|
-
end
|
12
|
+
class ServiceUnavailableError < Error; end
|
20
13
|
end
|
21
14
|
end
|
data/lib/spearly/cloud/client.rb
CHANGED
@@ -7,13 +7,13 @@ module Spearly
|
|
7
7
|
@token = token
|
8
8
|
end
|
9
9
|
|
10
|
-
def get_sites(params
|
10
|
+
def get_sites(params)
|
11
11
|
uri = "#{ENV.fetch('SPEARLY_API_URL', nil)}/sites"
|
12
12
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
13
13
|
client = Faraday.default_connection
|
14
14
|
|
15
15
|
res = client.get(uri_parsed,
|
16
|
-
params
|
16
|
+
params,
|
17
17
|
'Accept' => 'application/vnd.spearly.v2+json',
|
18
18
|
'Authorization' => @token)
|
19
19
|
|
data/lib/spearly/version.rb
CHANGED
data/spearly.gemspec
CHANGED
@@ -10,7 +10,7 @@ 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('>=
|
13
|
+
gem.required_ruby_version = Gem::Requirement.new('>= 3.1.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"
|
@@ -25,11 +25,4 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_runtime_dependency 'addressable', '~> 2.3'
|
26
26
|
gem.add_runtime_dependency 'faraday', '>= 0.17.4', '< 2.0'
|
27
27
|
gem.add_runtime_dependency 'signet', '~> 0.15'
|
28
|
-
|
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'
|
33
|
-
gem.add_development_dependency 'rubocop', '~> 1.15'
|
34
|
-
gem.add_development_dependency 'rubocop-rspec', '~> 2.3'
|
35
28
|
end
|