convox_api_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 42e2b8582bab65a923ff12fe788b8c6564c7d546
4
+ data.tar.gz: a4a024126915eeb6167914de4a38469ff201b957
5
+ SHA512:
6
+ metadata.gz: 7a9f9f430eedea601dcde8416388cd4e3578da1ae725e0bedee1dea59b0fe46f0b965da4029738af761cab6fab839b3baf9d08112f9bc3f4c97c27181f3ed622
7
+ data.tar.gz: 0dca56d19adf82be44f7841785c58c7c7e37cd9c84ade4c4479834f436e235ba880b4cc17eb2c73379697d7c5206386152aa95b6d193fae75ffec7ce69935754
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ /.byebug_history
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at matt@futureworkshops.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in convox_api_client.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 fw.matt
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,43 @@
1
+ # ConvoxApiClient
2
+
3
+ Thin wrapper around the Convox console API found at:
4
+
5
+ ```ruby
6
+ https://convox.com/api
7
+ ```
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'convox_api_client'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install convox_api_client
24
+
25
+ ## Usage
26
+
27
+ Create a new ```Convox::API::Client``` with your API key and call the wrapper methods.
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/HarmonyMobile/convox_api_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
38
+
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
43
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "convox_api_client"
5
+ require 'byebug'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'convox_api_client/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "convox_api_client"
8
+ spec.version = ConvoxApiClient::VERSION
9
+ spec.authors = ["fw.matt"]
10
+ spec.email = ["matt@futureworkshops.com"]
11
+
12
+ spec.summary = 'Ruby API client for the Convox platform'
13
+ spec.homepage = 'https://github.com/HarmonyMobile/convox_api_client.git'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'httparty', '>= 0.14.0'
22
+ spec.add_dependency 'httmultiparty', '>= 0.3.16'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "byebug"
28
+ end
@@ -0,0 +1,10 @@
1
+ require 'httparty'
2
+ require 'httmultiparty'
3
+ require 'convox_api_client/version'
4
+ require 'convox_api_client/client'
5
+
6
+ module Convox
7
+ module Api
8
+
9
+ end
10
+ end
@@ -0,0 +1,240 @@
1
+ module Convox
2
+ module Api
3
+ class Client
4
+ include HTTMultiParty
5
+ debug_output $stdout
6
+ format :json
7
+ base_uri 'https://console.convox.com'
8
+
9
+ def initialize(api_key)
10
+ raise 'api_key must be set' if api_key.nil?
11
+ @api_key = api_key
12
+ end
13
+
14
+ def apps(rack: nil)
15
+ query = {}
16
+ query[:rack] = rack if rack
17
+ parsed_response!(self.class.get('/apps', query: query, headers: authorization_headers))
18
+ end
19
+
20
+ def create_app(name, rack: nil)
21
+ query = {name: name}
22
+ query[:rack] = rack if rack
23
+ parsed_response!(self.class.post('/apps', query: query, headers: authorization_headers))
24
+ end
25
+
26
+ def delete_app(name, rack: nil)
27
+ query = {}
28
+ query[:rack] = rack if rack
29
+ parsed_response!(self.class.delete("/apps/#{name}", query: query, headers: authorization_headers))
30
+ end
31
+
32
+ def app(app, rack: nil)
33
+ query = {}
34
+ query[:rack] = rack if rack
35
+ parsed_response!(self.class.get("/apps/#{app}", query: query, headers: authorization_headers))
36
+ end
37
+
38
+ def app_builds(app, rack: nil)
39
+ query = {}
40
+ query[:rack] = rack if rack
41
+ parsed_response!(self.class.get("/apps/#{app}/builds", query: query, headers: authorization_headers))
42
+ end
43
+
44
+ def create_app_build(app, rack: nil, cache: nil, description: nil, manifest: 'docker-compose.yml', repo: nil, source: nil)
45
+ query = {}
46
+ query[:rack] = rack if rack
47
+ query[:cache] = cache if cache
48
+ query[:description] = description if description
49
+ query[:manifest] = manifest if manifest
50
+ query[:repo] = repo if repo
51
+ query[:source] = source if source
52
+
53
+ parsed_response!(self.class.post("/apps/#{app}/builds", query: query, headers: authorization_headers))
54
+ end
55
+
56
+ # API not functioning
57
+ def delete_app_build(app, build, rack: nil)
58
+ query = {}
59
+ query[:rack] = rack if rack
60
+ parsed_response!(self.class.delete("/apps/#{app}/builds/#{build}", query: query, headers: authorization_headers))
61
+ end
62
+
63
+ # API not functioning
64
+ def app_build(app, build, rack: nil)
65
+ query = {}
66
+ query[:rack] = rack if rack
67
+ parsed_response!(self.class.delete("/apps/#{app}/builds/#{build}", query: query, headers: authorization_headers))
68
+ end
69
+
70
+ def update_app_build(app, build, rack: nil)
71
+ raise 'Not implemented'
72
+ end
73
+
74
+ def app_environment(app, rack: nil)
75
+ query = {}
76
+ query[:rack] = rack if rack
77
+ parsed_response!(self.class.get("/apps/#{app}/environment", query: query, headers: authorization_headers))
78
+ end
79
+
80
+ def set_app_environment(app, environment, rack: nil)
81
+ query = {}
82
+ query[:rack] = rack if rack
83
+ parsed_response!(self.class.post("/apps/#{app}/environment", query: query, body: environment, headers: authorization_headers))
84
+ end
85
+
86
+ def delete_app_environment_key(app, key, rack: nil)
87
+ query = {}
88
+ query[:rack] = rack if rack
89
+ parsed_response!(self.class.delete("/apps/#{app}/environment/#{key}", query: query, headers: authorization_headers))
90
+ end
91
+
92
+ def app_formation(app, rack: nil)
93
+ raise 'Not implemented'
94
+ end
95
+
96
+ def create_app_formation_process(app, process, rack: nil, count: nil, memory: nil)
97
+ raise 'Not implemented'
98
+ end
99
+
100
+ def app_parameters(app, rack: nil)
101
+ raise 'Not implemented'
102
+ end
103
+
104
+ def set_app_parameters(app, parameters, rack: nil)
105
+ raise 'Not implemented'
106
+ end
107
+
108
+ def app_processes(app, rack: nil, stats: nil)
109
+ raise 'Not implemented'
110
+ end
111
+
112
+ def delete_app_process(app, process, rack: nil)
113
+ raise 'Not implemented'
114
+ end
115
+
116
+ def app_process(app, process, rack: nil)
117
+ raise 'Not implemented'
118
+ end
119
+
120
+ def run_app_process(app, process, rack: nil, command: nil)
121
+ raise 'Not implemented'
122
+ end
123
+
124
+ def app_releases(app, rack: nil)
125
+ query = {}
126
+ query[:rack] = rack if rack
127
+ parsed_response!(self.class.get("/apps/#{app}/releases", query: query, headers: authorization_headers))
128
+ end
129
+
130
+ def app_release(app, release, rack: nil)
131
+ query = {}
132
+ query[:rack] = rack if rack
133
+ parsed_response!(self.class.get("/apps/#{app}/releases/#{release}", query: query, headers: authorization_headers))
134
+ end
135
+
136
+ def promote_app_release(app, release, rack: nil)
137
+ query = {}
138
+ query[:rack] = rack if rack
139
+ parsed_response!(self.class.get("/apps/#{app}/releases/#{release}/promote", query: query, headers: authorization_headers))
140
+ end
141
+
142
+ def app_ssls(app, rack: nil)
143
+ query = {}
144
+ query[:rack] = rack if rack
145
+ parsed_response!(self.class.get("/apps/#{app}/ssl", query: query, headers: authorization_headers))
146
+ end
147
+
148
+ def set_app_ssl(app, process, port, rack: nil)
149
+ raise 'Not implemented'
150
+ end
151
+
152
+ def certificates
153
+ raise 'Not implemented'
154
+ end
155
+
156
+ def add_certificate(public, private, chain: nil)
157
+ raise 'Not implemented'
158
+ end
159
+
160
+ def generate_certificate(domains: nil)
161
+ raise 'Not implemented'
162
+ end
163
+
164
+ def delete_certificate(id: nil)
165
+ raise 'Not implemented'
166
+ end
167
+
168
+ def instances
169
+ raise 'Not implemented'
170
+ end
171
+
172
+ def instances_keyroll
173
+ raise 'Not implemented'
174
+ end
175
+
176
+ def delete_instance(id: nil)
177
+ raise 'Not implemented'
178
+ end
179
+
180
+ def delete_registries
181
+ raise 'Not implemented'
182
+ end
183
+
184
+ def registries
185
+ raise 'Not implemented'
186
+ end
187
+
188
+ def create_registry(server: nil, username: nil, password: nil)
189
+ raise 'Not implemented'
190
+ end
191
+
192
+ def services
193
+ raise 'Not implemented'
194
+ end
195
+
196
+ def create_service(name, type)
197
+ raise 'Not implemented'
198
+ end
199
+
200
+ def delete_service(name)
201
+ raise 'Not implemented'
202
+ end
203
+
204
+ def service(name)
205
+ raise 'Not implemented'
206
+ end
207
+
208
+ def create_service_link(service, app)
209
+ raise 'Not implemented'
210
+ end
211
+
212
+ def delete_service_link(service, app)
213
+ raise 'Not implemented'
214
+ end
215
+
216
+ def system(rack: nil)
217
+ raise 'Not implemented'
218
+ end
219
+
220
+ def update_system(count: nil, type: nil, version: nil)
221
+ raise 'Not implemented'
222
+ end
223
+
224
+ def system_capacity
225
+ raise 'Not implemented'
226
+ end
227
+
228
+ private
229
+ def parsed_response!(response)
230
+ raise "Error: #{response.code} #{response.body}" unless response.code == 200
231
+ response.parsed_response
232
+ end
233
+
234
+ def authorization_headers
235
+ auth_b64 = Base64.encode64("convox:#{@api_key}")
236
+ {'Authorization' => "Basic #{auth_b64}"}
237
+ end
238
+ end
239
+ end
240
+ end
@@ -0,0 +1,3 @@
1
+ module ConvoxApiClient
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: convox_api_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - fw.matt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.14.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.14.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: httmultiparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.16
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.16
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - matt@futureworkshops.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - CODE_OF_CONDUCT.md
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - convox_api_client.gemspec
114
+ - lib/convox_api_client.rb
115
+ - lib/convox_api_client/client.rb
116
+ - lib/convox_api_client/version.rb
117
+ homepage: https://github.com/HarmonyMobile/convox_api_client.git
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.6.10
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Ruby API client for the Convox platform
141
+ test_files: []