deploygate-client 0.1.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 +7 -0
- data/.circleci/config.yml +22 -0
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +8 -0
- data/bin/console +9 -0
- data/bin/setup +8 -0
- data/deploygate-client.gemspec +35 -0
- data/lib/deploygate/client.rb +33 -0
- data/lib/deploygate/client/api.rb +31 -0
- data/lib/deploygate/client/apps.rb +176 -0
- data/lib/deploygate/client/organizations.rb +169 -0
- data/lib/deploygate/client/response.rb +20 -0
- data/lib/deploygate/client/version.rb +7 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 18f7df24971bb010a5601270f586a04e107d9d1f4f60bc6d165ddd2a550eeafa
|
4
|
+
data.tar.gz: bbe6d47b13f411889cde356a8bb217aa969825658e2a296a67b92b165a3e163b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 932f6d6cf06322919e976a2a30bf413186ba85e5c25e50e7eeb4c58c13b22649e136fd168b43adfbe6c7091afcbc6dcbbab7847010284c56bd3e1a900f265cb4
|
7
|
+
data.tar.gz: ec127863237a22fc58de339e276031cefe80a59f92957e317ca6a6d443b4f66883c543d4544d517dc914dce640c2577ef73148153be91613e00dd62941267bb6
|
@@ -0,0 +1,22 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.6.0-node-browsers
|
6
|
+
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
|
10
|
+
- run:
|
11
|
+
name: install dependencies
|
12
|
+
command: |
|
13
|
+
gem install bundler
|
14
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
15
|
+
|
16
|
+
- run:
|
17
|
+
name: run tests
|
18
|
+
command: bundle exec rspec
|
19
|
+
|
20
|
+
- run:
|
21
|
+
name: run lint
|
22
|
+
command: bundle exec rubocop
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 ntsk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Deploygate::Client
|
2
|
+
This is an unofficial ruby client library for [DeployGate](https://deploygate.com).
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'deploygate-client'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install deploygate-client
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
client = Deploygate::Client.new(token: 'YOUR_DEPLOYGATE_TOKEN')
|
24
|
+
|
25
|
+
# GET https://deploygate.com/api/organizations
|
26
|
+
response = client.organizations
|
27
|
+
```
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ntsk/deploygate-client.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'deploygate/client/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'deploygate-client'
|
9
|
+
spec.version = Deploygate::Client::VERSION
|
10
|
+
spec.authors = ['ntsk']
|
11
|
+
spec.email = ['ridha.h2a26@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'DeployGate API library for Ruby'
|
14
|
+
spec.description = 'DeployGate API library for Ruby'
|
15
|
+
spec.homepage = 'https://github.com/ntsk/deploygate-client'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
20
|
+
f.match(%r{^(test|spec|features)/})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_runtime_dependency 'faraday'
|
28
|
+
spec.add_runtime_dependency 'faraday_middleware'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
+
spec.add_development_dependency 'pry'
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'rubocop'
|
35
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'deploygate/client/version'
|
4
|
+
require 'deploygate/client/api'
|
5
|
+
require 'deploygate/client/apps'
|
6
|
+
require 'deploygate/client/organizations'
|
7
|
+
|
8
|
+
module Deploygate
|
9
|
+
# Client for the Deploygate API
|
10
|
+
#
|
11
|
+
# @see https://docs.deploygate.com/reference#deploygate-api
|
12
|
+
class Client
|
13
|
+
include Deploygate::Client::API
|
14
|
+
include Deploygate::Client::Apps
|
15
|
+
include Deploygate::Client::Organizations
|
16
|
+
|
17
|
+
attr_reader :token, :symbolize_response, :open_timeout, :timeout
|
18
|
+
|
19
|
+
# Use options passed in
|
20
|
+
#
|
21
|
+
# @param token [String] DeployGate API token
|
22
|
+
# @option symbolize_response [Boolean] Parse response to symbolized hash
|
23
|
+
# @option open_timeout [Integer] Open timeout Integer in seconds
|
24
|
+
# @option timeout [Integer] Read timeout Integer in seconds
|
25
|
+
# @return [Deploygate::Client]
|
26
|
+
def initialize(token:, symbolize_response: false, open_timeout: 10, timeout: 30)
|
27
|
+
@token = token
|
28
|
+
@symbolize_response = symbolize_response
|
29
|
+
@open_timeout = open_timeout
|
30
|
+
@timeout = timeout
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
|
6
|
+
module Deploygate
|
7
|
+
class Client
|
8
|
+
# Default faraday settings
|
9
|
+
module API
|
10
|
+
BASE_URL = 'https://deploygate.com'
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def api
|
15
|
+
@api ||= Faraday.new(url: BASE_URL) do |builder|
|
16
|
+
builder.options.open_timeout = open_timeout
|
17
|
+
builder.options.timeout = timeout
|
18
|
+
|
19
|
+
builder.request :multipart
|
20
|
+
|
21
|
+
if symbolize_response
|
22
|
+
builder.response :json, parser_options: { symbolize_names: true }
|
23
|
+
end
|
24
|
+
|
25
|
+
builder.headers['Authorization'] = "token #{token}"
|
26
|
+
builder.adapter Faraday.default_adapter
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'deploygate/client/response'
|
4
|
+
|
5
|
+
module Deploygate
|
6
|
+
class Client
|
7
|
+
# Request to application endpoints
|
8
|
+
module Apps
|
9
|
+
PLATFORM_ANDROID = 'android'
|
10
|
+
PLATFORM_IOS = 'ios'
|
11
|
+
ROLE_DEVELOPER = 1
|
12
|
+
ROLE_TESTER = 2
|
13
|
+
|
14
|
+
# Upload an application binary file.
|
15
|
+
# @see https://docs.deploygate.com/reference#upload
|
16
|
+
#
|
17
|
+
# @param owner [String] User or organization name
|
18
|
+
# @param file_path [String] Application binary file(ipa/apk)
|
19
|
+
# @option message [String] Description of the file
|
20
|
+
# @option dist_key [String] Distribution page hash
|
21
|
+
# @option dist_name [String] Distribution page name
|
22
|
+
# @option release_note [String] Message for distribution page
|
23
|
+
# @option disable_notify [Boolean] Email notification for push(only ios)
|
24
|
+
# @option visibility [String] Application privacy(private/public)
|
25
|
+
# @return [Deploygate::Client::Response]
|
26
|
+
def upload_app(
|
27
|
+
owner:,
|
28
|
+
file_path:,
|
29
|
+
message: nil,
|
30
|
+
dist_key: nil,
|
31
|
+
dist_name: nil,
|
32
|
+
release_note: nil,
|
33
|
+
disable_notify: nil,
|
34
|
+
visibility: nil
|
35
|
+
)
|
36
|
+
endpoint = "/api/users/#{owner}/apps"
|
37
|
+
res = api.post endpoint do |request|
|
38
|
+
request.body = {
|
39
|
+
file: Faraday::UploadIO.new(file_path, 'octet/stream'),
|
40
|
+
message: message,
|
41
|
+
distribution_key: dist_key,
|
42
|
+
distribution_name: dist_name,
|
43
|
+
release_note: release_note,
|
44
|
+
disable_notify: disable_notify,
|
45
|
+
visibility: visibility
|
46
|
+
}
|
47
|
+
end
|
48
|
+
Response.new(res)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Invite users to the app.
|
52
|
+
# @see https://docs.deploygate.com/reference#invite
|
53
|
+
#
|
54
|
+
# @param owner [String] User or organization name
|
55
|
+
# @param platform [String] Application platform(ios/android)
|
56
|
+
# @param app_id [String] Application package name
|
57
|
+
# @param users [String] User name or email
|
58
|
+
# (You can specify multiple values separated by commas)
|
59
|
+
# @option role[String] 1(developer) or 2(tester)
|
60
|
+
# @return [Deploygate::Client::Response]
|
61
|
+
def add_app_members(owner:, platform:, app_id:, users:, role: nil)
|
62
|
+
endpoint = "/api/users/#{owner}/platforms/#{platform}/apps/#{app_id}/members"
|
63
|
+
res = api.post endpoint do |request|
|
64
|
+
request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
65
|
+
request.body = URI.encode_www_form(
|
66
|
+
users: users,
|
67
|
+
role: role
|
68
|
+
)
|
69
|
+
end
|
70
|
+
Response.new(res)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get a list of members participating in the app.
|
74
|
+
# @see https://docs.deploygate.com/reference#apps-members-index
|
75
|
+
#
|
76
|
+
# @param owner [String] User or organization name
|
77
|
+
# @param platform [String] Application platform(ios/android)
|
78
|
+
# @param app_id [String] Application package name
|
79
|
+
# @return [Deploygate::Client::Response]
|
80
|
+
def app_members(owner:, platform:, app_id:)
|
81
|
+
endpoint = "/api/users/#{owner}/platforms/#{platform}/apps/#{app_id}/members"
|
82
|
+
res = api.get endpoint
|
83
|
+
Response.new(res)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Delete members from the app.
|
87
|
+
# @see https://docs.deploygate.com/reference#apps-members-destroy
|
88
|
+
#
|
89
|
+
# @param owner [String] User or organization name
|
90
|
+
# @param platform [String] Application platform (ios/android)
|
91
|
+
# @param app_id [String] Application package name
|
92
|
+
# @param users [String] User name or email
|
93
|
+
# (You can specify multiple values separated by commas)
|
94
|
+
# @return [Deploygate::Client::Response]
|
95
|
+
def delete_app_members(owner:, platform:, app_id:, users:)
|
96
|
+
endpoint = "/api/users/#{owner}/platforms/#{platform}/apps/#{app_id}/members"
|
97
|
+
res = api.delete endpoint do |request|
|
98
|
+
request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
99
|
+
request.body = URI.encode_www_form(
|
100
|
+
users: users
|
101
|
+
)
|
102
|
+
end
|
103
|
+
Response.new(res)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Get a list of teams participating in the app.
|
107
|
+
# @see https://docs.deploygate.com/reference#apps-teams-index
|
108
|
+
#
|
109
|
+
# @param org_name [String] Organization name
|
110
|
+
# @param platform [String] Application platform(ios/android)
|
111
|
+
# @param app_id [String] Application package name
|
112
|
+
# @return [Deploygate::Client::Response]
|
113
|
+
def app_teams(org_name:, platform:, app_id:)
|
114
|
+
endpoint = "/api/organizations/#{org_name}/platforms/#{platform}"\
|
115
|
+
"/apps/#{app_id}/teams"
|
116
|
+
res = api.get endpoint
|
117
|
+
Response.new(res)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Add teams to the app,
|
121
|
+
# @see https://docs.deploygate.com/reference#apps-teams-create
|
122
|
+
#
|
123
|
+
# @param org_name [String] Organization name
|
124
|
+
# @param platform [String] Application platform(ios/android)
|
125
|
+
# @param app_id [String] Application package name
|
126
|
+
# @param team [String] Team name
|
127
|
+
# @return [Deploygate::Client::Response]
|
128
|
+
def add_app_team(org_name:, platform:, app_id:, team_name:)
|
129
|
+
endpoint = "/api/organizations/#{org_name}/platforms/#{platform}"\
|
130
|
+
"/apps/#{app_id}/teams"
|
131
|
+
res = api.post endpoint do |request|
|
132
|
+
request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
133
|
+
request.body = URI.encode_www_form(
|
134
|
+
team: team_name
|
135
|
+
)
|
136
|
+
end
|
137
|
+
Response.new(res)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Delete team from the app.
|
141
|
+
# @see https://docs.deploygate.com/reference#apps-teams-destroy
|
142
|
+
#
|
143
|
+
# @param org_name [String] Organization name
|
144
|
+
# @param platform [String] Application platform(ios/android)
|
145
|
+
# @param app_id [String] Application package name
|
146
|
+
# @param team [String] Team name
|
147
|
+
# @return [Deploygate::Client::Response]
|
148
|
+
def delete_app_team(org_name:, platform:, app_id:, team_name:)
|
149
|
+
endpoint = "/api/organizations/#{org_name}/platforms/#{platform}"\
|
150
|
+
"/apps/#{app_id}/teams/#{team_name}"
|
151
|
+
res = api.delete endpoint
|
152
|
+
Response.new(res)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Delete distribution page.
|
156
|
+
# @see https://docs.deploygate.com/reference#delete-distribution-page-by-name
|
157
|
+
#
|
158
|
+
# @param owner [String] User or organization name
|
159
|
+
# @param platform [String] Application platform(ios/android)
|
160
|
+
# @param app_id [String] Application package name
|
161
|
+
# @param dist_name [String] Distribution page name
|
162
|
+
# @return [Deploygate::Client::Response]
|
163
|
+
def delete_app_distribution(owner:, platform:, app_id:, dist_name:)
|
164
|
+
endpoint = "/api/users/#{owner}/platforms/#{platform}"\
|
165
|
+
"/apps/#{app_id}/distributions"
|
166
|
+
res = api.delete endpoint do |request|
|
167
|
+
request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
168
|
+
request.body = URI.encode_www_form(
|
169
|
+
distribution_name: dist_name
|
170
|
+
)
|
171
|
+
end
|
172
|
+
Response.new(res)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'deploygate/client/response'
|
4
|
+
|
5
|
+
module Deploygate
|
6
|
+
class Client
|
7
|
+
# Request to organizations endpoints
|
8
|
+
module Organizations
|
9
|
+
# Get a list of organizations.
|
10
|
+
# @see https://docs.deploygate.com/reference#organizations-index
|
11
|
+
#
|
12
|
+
# @return [Deploygate::Client::Response]
|
13
|
+
def organizations
|
14
|
+
res = api.get '/api/organizations'
|
15
|
+
Response.new(res)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Create an organization.
|
19
|
+
# @see https://docs.deploygate.com/reference#organizations-index
|
20
|
+
#
|
21
|
+
# @param org_name [String] Organization name
|
22
|
+
# @option description [String] Organization description
|
23
|
+
# @return [Deploygate::Client::Response]
|
24
|
+
def add_organization(org_name:, description: nil)
|
25
|
+
res = api.post '/api/organizations' do |request|
|
26
|
+
request.params[:name] = org_name
|
27
|
+
request.params[:description] = description
|
28
|
+
end
|
29
|
+
Response.new(res)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get organization information.
|
33
|
+
# @see https://docs.deploygate.com/reference#organizations-show
|
34
|
+
#
|
35
|
+
# @param org_name [String] Organization name
|
36
|
+
# @return [Deploygate::Client::Response]
|
37
|
+
def organization(org_name:)
|
38
|
+
res = api.get "/api/organizations/#{org_name}"
|
39
|
+
Response.new(res)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Update organization information.
|
43
|
+
# @see https://docs.deploygate.com/reference#organizations-update
|
44
|
+
#
|
45
|
+
# @param org_name [String] Organization name
|
46
|
+
# @option description [String] Organization description
|
47
|
+
# @return [Deploygate::Client::Response]
|
48
|
+
def update_organization(org_name:, description: nil)
|
49
|
+
res = api.patch "/api/organizations/#{org_name}" do |request|
|
50
|
+
request.params[:description] = description
|
51
|
+
end
|
52
|
+
Response.new(res)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Delete organization information.
|
56
|
+
# @see https://docs.deploygate.com/reference#organizations-destroy
|
57
|
+
#
|
58
|
+
# @param org_name [String] Organization name
|
59
|
+
# @return [Deploygate::Client::Response]
|
60
|
+
def delete_organization(org_name:)
|
61
|
+
res = api.delete "/api/organizations/#{org_name}"
|
62
|
+
Response.new(res)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Get a list of organization members.
|
66
|
+
# @see https://docs.deploygate.com/reference#organizations-members-index
|
67
|
+
#
|
68
|
+
# @param org_name [String] Organization name
|
69
|
+
# @return [Deploygate::Client::Response]
|
70
|
+
def organization_members(org_name:)
|
71
|
+
res = api.get "/api/organizations/#{org_name}/members"
|
72
|
+
Response.new(res)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Add members to the organization.
|
76
|
+
# @see https://docs.deploygate.com/reference#organizations-members-create
|
77
|
+
#
|
78
|
+
# @param org_name [String] Organization name
|
79
|
+
# @param user_name [String] User name
|
80
|
+
# @return [Deploygate::Client::Response]
|
81
|
+
def add_organization_member(org_name:, user_name:)
|
82
|
+
res = api.post "/api/organizations/#{org_name}/members" do |request|
|
83
|
+
request.params[:username] = user_name
|
84
|
+
end
|
85
|
+
Response.new(res)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Add members to the organization.
|
89
|
+
# @see https://docs.deploygate.com/reference#organizations-members-create
|
90
|
+
#
|
91
|
+
# @param org_name [String] Organization name
|
92
|
+
# @param email [String] User email
|
93
|
+
# @return [Deploygate::Client::Response]
|
94
|
+
def add_organization_member_by_email(org_name:, email:)
|
95
|
+
res = api.post "/api/organizations/#{org_name}/members" do |request|
|
96
|
+
request.params[:email] = email
|
97
|
+
end
|
98
|
+
Response.new(res)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Delete members to the organization.
|
102
|
+
# @see https://docs.deploygate.com/reference#organizations-members-destroy
|
103
|
+
#
|
104
|
+
# @param org_name [String] Organization name
|
105
|
+
# @param user_name [String] User name
|
106
|
+
# @return [Deploygate::Client::Response]
|
107
|
+
def delete_organization_member(org_name:, user_name:)
|
108
|
+
endpoint = "/api/organizations/#{org_name}/members/#{user_name}"
|
109
|
+
res = api.delete endpoint do |request|
|
110
|
+
request.params[:id] = user_name
|
111
|
+
end
|
112
|
+
Response.new(res)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Delete members from the organization.
|
116
|
+
# @see https://docs.deploygate.com/reference#organizations-members-destroy
|
117
|
+
#
|
118
|
+
# @param org_name [String] Organization name
|
119
|
+
# @param email [String] User email
|
120
|
+
# @return [Deploygate::Client::Response]
|
121
|
+
def delete_organization_member_by_email(org_name:, email:)
|
122
|
+
endpoint = "/api/organizations/#{org_name}/members/#{email}"
|
123
|
+
res = api.delete endpoint do |request|
|
124
|
+
request.params[:id] = email
|
125
|
+
end
|
126
|
+
Response.new(res)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Get a list of team members.
|
130
|
+
# @see https://docs.deploygate.com/reference#organizations-teams-users-index
|
131
|
+
#
|
132
|
+
# @param org_name [String] Organization name
|
133
|
+
# @param team_name [String] Team name
|
134
|
+
# @return [Deploygate::Client::Response]
|
135
|
+
def team_members(org_name:, team_name:)
|
136
|
+
res = api.get "/api/organizations/#{org_name}/teams/#{team_name}/users"
|
137
|
+
Response.new(res)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Add members to the team.
|
141
|
+
# @see https://docs.deploygate.com/reference#organizations-teams-users-create
|
142
|
+
#
|
143
|
+
# @param org_name [String] Organization name
|
144
|
+
# @param team_name [String] Team name
|
145
|
+
# @param user_name [String] User name
|
146
|
+
# @return [Deploygate::Client::Response]
|
147
|
+
def add_team_member(org_name:, team_name:, user_name:)
|
148
|
+
endpoint = "/api/organizations/#{org_name}/teams/#{team_name}/users"
|
149
|
+
res = api.post endpoint do |request|
|
150
|
+
request.params[:user] = user_name
|
151
|
+
end
|
152
|
+
Response.new(res)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Delete members from the team.
|
156
|
+
# @see https://docs.deploygate.com/reference#organizations-teams-users-destroy
|
157
|
+
#
|
158
|
+
# @param org_name [String] Organization name
|
159
|
+
# @param team_name [String] Team name
|
160
|
+
# @param user_name [String] User name
|
161
|
+
# @return [Deploygate::Client::Response]
|
162
|
+
def delete_team_member(org_name:, team_name:, user_name:)
|
163
|
+
endpoint = "/api/organizations/#{org_name}/teams/#{team_name}/users/#{user_name}"
|
164
|
+
res = api.delete endpoint
|
165
|
+
Response.new(res)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Deploygate
|
4
|
+
class Client
|
5
|
+
# Api response
|
6
|
+
class Response
|
7
|
+
attr_accessor :body, :headers, :status
|
8
|
+
|
9
|
+
def initialize(f_response)
|
10
|
+
@body = f_response.body
|
11
|
+
@headers = f_response.headers
|
12
|
+
@status = f_response.status
|
13
|
+
end
|
14
|
+
|
15
|
+
def success?
|
16
|
+
(200..299).include?(status)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deploygate-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ntsk
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: DeployGate API library for Ruby
|
112
|
+
email:
|
113
|
+
- ridha.h2a26@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".circleci/config.yml"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- bin/console
|
127
|
+
- bin/setup
|
128
|
+
- deploygate-client.gemspec
|
129
|
+
- lib/deploygate/client.rb
|
130
|
+
- lib/deploygate/client/api.rb
|
131
|
+
- lib/deploygate/client/apps.rb
|
132
|
+
- lib/deploygate/client/organizations.rb
|
133
|
+
- lib/deploygate/client/response.rb
|
134
|
+
- lib/deploygate/client/version.rb
|
135
|
+
homepage: https://github.com/ntsk/deploygate-client
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubygems_version: 3.0.6
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: DeployGate API library for Ruby
|
158
|
+
test_files: []
|