spearly-sdk-ruby 0.5.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/lib/spearly/auth/client.rb +34 -0
- data/lib/spearly/cloud/client.rb +43 -0
- data/lib/spearly/cloud.rb +11 -0
- data/lib/spearly/version.rb +1 -1
- data/lib/spearly.rb +1 -0
- data/spearly.gemspec +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63b85112898d41d2cfb6f4a65f45e371f5c83cef8ea80402c80f5e2914a32aa
|
4
|
+
data.tar.gz: bf0cda8a4184a7e3bbe29ff067f5b575969c60c67f14737bd3d723de5fe32091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25732ccb37984d326cb936cdbba1c7a11fccbbdf034b52ba96c542c759e0eeedcd47d5e873aeb3be439e02f069e37b8d7ccddc404dbe43759a081d7a7e7f8b78
|
7
|
+
data.tar.gz: 4d42a6e0fb080d2c94eef1d3d827317b0ec292d00f771beeedb132b6cc53105369531d4e5689b40ad218d2e5dc53b3eb066b48644d5e421c544e00db2ccba640
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
## [0.8.0] - 2022-06-15
|
2
|
+
|
3
|
+
- `Spearly::Auth::Client#get_user`
|
4
|
+
|
5
|
+
## [0.7.0] - 2022-01-31
|
6
|
+
|
7
|
+
- `Spearly::Cloud::Client#get_site`
|
8
|
+
- `Spearly::Cloud::Client#get_sites`
|
9
|
+
|
10
|
+
## [0.6.0] - 2022-01-20
|
11
|
+
|
12
|
+
- `Spearly::Auth::Client#get_team_features`
|
13
|
+
|
1
14
|
## [0.5.0] - 2021-12-13
|
2
15
|
|
3
|
-
- Spearly::Auth::Client
|
16
|
+
- `Spearly::Auth::Client`
|
4
17
|
|
5
18
|
## [0.4.0] - 2021-09-13
|
6
19
|
|
data/lib/spearly/auth/client.rb
CHANGED
@@ -5,6 +5,23 @@ module Spearly
|
|
5
5
|
@token = token
|
6
6
|
end
|
7
7
|
|
8
|
+
def get_user(user_id)
|
9
|
+
uri = "#{ENV['SPEARLY_API_URL']}/users/#{user_id}"
|
10
|
+
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
11
|
+
client = Faraday.default_connection
|
12
|
+
|
13
|
+
res = client.get(uri_parsed,
|
14
|
+
nil,
|
15
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
16
|
+
'Authorization' => @token)
|
17
|
+
|
18
|
+
if res.status == 200
|
19
|
+
JSON.parse(res.body)['data']
|
20
|
+
else
|
21
|
+
{}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
8
25
|
def create_team(params)
|
9
26
|
uri = "#{ENV['SPEARLY_API_URL']}/teams"
|
10
27
|
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
@@ -123,6 +140,23 @@ module Spearly
|
|
123
140
|
[]
|
124
141
|
end
|
125
142
|
end
|
143
|
+
|
144
|
+
def get_team_features(team_id)
|
145
|
+
uri = "#{ENV['SPEARLY_API_URL']}/teams/#{team_id}/features"
|
146
|
+
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
147
|
+
client = Faraday.default_connection
|
148
|
+
|
149
|
+
res = client.get(uri_parsed,
|
150
|
+
nil,
|
151
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
152
|
+
'Authorization' => @token)
|
153
|
+
|
154
|
+
if res.status == 200
|
155
|
+
JSON.parse(res.body)['data']
|
156
|
+
else
|
157
|
+
{}
|
158
|
+
end
|
159
|
+
end
|
126
160
|
end
|
127
161
|
end
|
128
162
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Spearly
|
2
|
+
module Cloud
|
3
|
+
class Client
|
4
|
+
def initialize(token)
|
5
|
+
@token = token
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_sites(params = {})
|
9
|
+
uri = "#{ENV['SPEARLY_API_URL']}/sites"
|
10
|
+
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
11
|
+
client = Faraday.default_connection
|
12
|
+
|
13
|
+
res = client.get(uri_parsed,
|
14
|
+
params.as_json,
|
15
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
16
|
+
'Authorization' => @token)
|
17
|
+
|
18
|
+
if res.status == 200
|
19
|
+
JSON.parse(res.body)['data']
|
20
|
+
else
|
21
|
+
[]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_site(site_id)
|
26
|
+
uri = "#{ENV['SPEARLY_API_URL']}/sites/#{site_id}"
|
27
|
+
uri_parsed = Addressable::URI.parse(uri).normalize.to_s
|
28
|
+
client = Faraday.default_connection
|
29
|
+
|
30
|
+
res = client.get(uri_parsed,
|
31
|
+
nil,
|
32
|
+
'Accept' => 'application/vnd.spearly.v2+json',
|
33
|
+
'Authorization' => @token)
|
34
|
+
|
35
|
+
if res.status == 200
|
36
|
+
JSON.parse(res.body)['data']
|
37
|
+
else
|
38
|
+
{}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/spearly/version.rb
CHANGED
data/lib/spearly.rb
CHANGED
data/spearly.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = 'spearly-sdk-ruby'
|
7
7
|
gem.version = Spearly::VERSION
|
8
8
|
gem.author = 'Spearly'
|
9
|
-
gem.email = ['
|
9
|
+
gem.email = ['dj@unimal.jp']
|
10
10
|
|
11
11
|
gem.summary = 'Spearly SDK for Ruby'
|
12
12
|
gem.homepage = 'https://github.com/unimal-jp/spearly-sdk-ruby'
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spearly
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -128,9 +128,9 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '2.3'
|
131
|
-
description:
|
131
|
+
description:
|
132
132
|
email:
|
133
|
-
-
|
133
|
+
- dj@unimal.jp
|
134
134
|
executables:
|
135
135
|
- spearly
|
136
136
|
extensions: []
|
@@ -157,6 +157,8 @@ files:
|
|
157
157
|
- lib/spearly/auth/team.rb
|
158
158
|
- lib/spearly/auth/token.rb
|
159
159
|
- lib/spearly/auth/user.rb
|
160
|
+
- lib/spearly/cloud.rb
|
161
|
+
- lib/spearly/cloud/client.rb
|
160
162
|
- lib/spearly/version.rb
|
161
163
|
- spearly.gemspec
|
162
164
|
- spec/spearly_spec.rb
|
@@ -166,8 +168,8 @@ licenses: []
|
|
166
168
|
metadata:
|
167
169
|
homepage_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
168
170
|
source_code_uri: https://github.com/unimal-jp/spearly-sdk-ruby
|
169
|
-
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.
|
170
|
-
post_install_message:
|
171
|
+
changelog_uri: https://github.com/unimal-jp/spearly-sdk-ruby/blob/v0.8.0/CHANGELOG.md
|
172
|
+
post_install_message:
|
171
173
|
rdoc_options: []
|
172
174
|
require_paths:
|
173
175
|
- lib
|
@@ -182,8 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
184
|
- !ruby/object:Gem::Version
|
183
185
|
version: '0'
|
184
186
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
186
|
-
signing_key:
|
187
|
+
rubygems_version: 3.3.7
|
188
|
+
signing_key:
|
187
189
|
specification_version: 4
|
188
190
|
summary: Spearly SDK for Ruby
|
189
191
|
test_files: []
|