deploygate-api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +2 -0
- data/bin/deploygate-api +5 -0
- data/deploygate-api.gemspec +27 -0
- data/lib/deploygate-api.rb +1 -0
- data/lib/deploygate/api.rb +13 -0
- data/lib/deploygate/api/cli.rb +20 -0
- data/lib/deploygate/api/invite.rb +51 -0
- data/lib/deploygate/api/push.rb +34 -0
- data/lib/deploygate/api/version.rb +5 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ca7f824be7f1a5b962dca4795d41c4241d6240d1
|
4
|
+
data.tar.gz: a4554a25d9e5b81ecee5798882350bf707a0bb6c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12c85327a9f961a5aec90b842ccda04f89d0b25de587a7cf781dc152abbb00cfaee2daa3bbf27fd2bd9611dbbee1ae26f19a47161ed8afe8ec693723395fa5a4
|
7
|
+
data.tar.gz: 3dd7f2c6a2caa16f22fbfc9ca644e93197ce36fda6af855c6f633464b6a7e909f7e64910fbf3d9062041451b2b998701a902f6cc3bc16eaff6c8ee53a0103fec
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Takeo Fujita
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# deploygate-api
|
2
|
+
|
3
|
+
ruby client for [deploygate](https://deploygate.com/) API (unofficial)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'deploygate-api'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install deploygate-api
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
require "deploygate-api"
|
22
|
+
|
23
|
+
owner_name = "YOUR USERNAME"
|
24
|
+
app_id = "com.example.app"
|
25
|
+
token = "YOUR API KEY"
|
26
|
+
|
27
|
+
Deploygate::Api::Push.upload_file(owner_name, token, "/path/to/binary")
|
28
|
+
Deploygate::Api::Invite.get_members(owner_name, app_id, token)
|
29
|
+
Deploygate::Api::Invite.add_members(owner_name, app_id, token, "username")
|
30
|
+
Deploygate::Api::Invite.remove_members(owner_name, app_id, token, "username")
|
31
|
+
|
32
|
+
## CLI Usage
|
33
|
+
|
34
|
+
$ deploygate-api help upload
|
35
|
+
Usage:
|
36
|
+
deploygate-api upload FILE -o, --owner-name=OWNER_NAME -t, --token=TOKEN
|
37
|
+
|
38
|
+
Options:
|
39
|
+
-o, --owner-name=OWNER_NAME
|
40
|
+
-t, --token=TOKEN
|
41
|
+
-m, [--message=MESSAGE]
|
42
|
+
-d, [--distribution-key=DISTRIBUTION_KEY]
|
43
|
+
-r, [--release-note=RELEASE_NOTE]
|
44
|
+
|
45
|
+
Upload application binary file
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/deploygate-api
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'deploygate/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "deploygate-api"
|
8
|
+
spec.version = Deploygate::Api::VERSION
|
9
|
+
spec.authors = ["Takeo Fujita"]
|
10
|
+
spec.email = ["takeofujita@gmail.com"]
|
11
|
+
spec.summary = %q{Ruby client for deploygate API}
|
12
|
+
spec.description = %q{Ruby client for deploygate API}
|
13
|
+
spec.homepage = "https://github.com/tkeo/deploygate-api"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "faraday"
|
22
|
+
spec.add_runtime_dependency "faraday_middleware"
|
23
|
+
spec.add_runtime_dependency "thor"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "deploygate/api"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "deploygate/api/version"
|
2
|
+
require "faraday"
|
3
|
+
require "faraday_middleware"
|
4
|
+
|
5
|
+
module Deploygate
|
6
|
+
module Api
|
7
|
+
autoload :Cli, "deploygate/api/cli"
|
8
|
+
autoload :Invite, "deploygate/api/invite"
|
9
|
+
autoload :Push, "deploygate/api/push"
|
10
|
+
|
11
|
+
BASE_URL = "https://deploygate.com"
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Deploygate::Api
|
4
|
+
class Cli < Thor
|
5
|
+
desc "upload FILE", "Upload application binary file"
|
6
|
+
method_option :owner_name, aliases: "-o", required: true
|
7
|
+
method_option :token, aliases: "-t", required: true
|
8
|
+
method_option :message, aliases: "-m"
|
9
|
+
method_option :distribution_key, aliases: "-d"
|
10
|
+
method_option :release_note, aliases: "-r"
|
11
|
+
def upload(filepath)
|
12
|
+
owner_name = options[:owner_name]
|
13
|
+
token = options[:token]
|
14
|
+
message = options[:message]
|
15
|
+
distribution_key = options[:distribution_key]
|
16
|
+
release_note = options[:release_note]
|
17
|
+
Push.upload_file(owner_name, token, filepath, message, distribution_key, release_note)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Deploygate::Api
|
2
|
+
module Invite
|
3
|
+
module Role
|
4
|
+
DEVELOPER = 1
|
5
|
+
TESTER = 2
|
6
|
+
end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def get_members(owner_name, app_id, token)
|
10
|
+
params = { token: token }
|
11
|
+
response = connection.get(endpoint_path(owner_name, app_id), params)
|
12
|
+
response.body
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_members(owner_name, app_id, token, users, role = Role::DEVELOPER)
|
16
|
+
params = {
|
17
|
+
token: token,
|
18
|
+
users: Array(users).join(","),
|
19
|
+
role: role,
|
20
|
+
}
|
21
|
+
response = connection.post(endpoint_path(owner_name, app_id), params)
|
22
|
+
response.body
|
23
|
+
end
|
24
|
+
|
25
|
+
def remove_members(owner_name, app_id, token, users)
|
26
|
+
params = {
|
27
|
+
token: token,
|
28
|
+
users: Array(users).join(","),
|
29
|
+
}
|
30
|
+
response = connection.delete(endpoint_path(owner_name, app_id), params)
|
31
|
+
response.body
|
32
|
+
end
|
33
|
+
|
34
|
+
def connection
|
35
|
+
Faraday.new(url: BASE_URL) do |faraday|
|
36
|
+
faraday.request :url_encoded
|
37
|
+
faraday.response :logger
|
38
|
+
faraday.response :json
|
39
|
+
faraday.adapter :net_http
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def endpoint_path(owner_name, app_id)
|
44
|
+
path = "/api/users/%<owner_name>s/apps/%<app_id>s/members" % {
|
45
|
+
owner_name: owner_name,
|
46
|
+
app_id: app_id,
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Deploygate::Api
|
2
|
+
module Push
|
3
|
+
class << self
|
4
|
+
def upload_file(owner_name, token, filepath,
|
5
|
+
message = nil, distribution_key = nil, release_note = nil)
|
6
|
+
params = {
|
7
|
+
token: token,
|
8
|
+
file: Faraday::UploadIO.new(filepath, "application/octet-stream"),
|
9
|
+
message: message,
|
10
|
+
distribution_key: distribution_key,
|
11
|
+
release_note: release_note,
|
12
|
+
}.select {|k, v| v }
|
13
|
+
response = connection.post(endpoint_path(owner_name), params)
|
14
|
+
response.body
|
15
|
+
end
|
16
|
+
|
17
|
+
def connection
|
18
|
+
Faraday.new(url: BASE_URL) do |faraday|
|
19
|
+
faraday.request :multipart
|
20
|
+
faraday.request :url_encoded
|
21
|
+
faraday.response :logger
|
22
|
+
faraday.response :json
|
23
|
+
faraday.adapter :net_http
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def endpoint_path(owner_name)
|
28
|
+
path = "/api/users/%<owner_name>s/apps" % {
|
29
|
+
owner_name: owner_name,
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deploygate-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takeo Fujita
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-18 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: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Ruby client for deploygate API
|
84
|
+
email:
|
85
|
+
- takeofujita@gmail.com
|
86
|
+
executables:
|
87
|
+
- deploygate-api
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/deploygate-api
|
97
|
+
- deploygate-api.gemspec
|
98
|
+
- lib/deploygate-api.rb
|
99
|
+
- lib/deploygate/api.rb
|
100
|
+
- lib/deploygate/api/cli.rb
|
101
|
+
- lib/deploygate/api/invite.rb
|
102
|
+
- lib/deploygate/api/push.rb
|
103
|
+
- lib/deploygate/api/version.rb
|
104
|
+
homepage: https://github.com/tkeo/deploygate-api
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Ruby client for deploygate API
|
128
|
+
test_files: []
|