turbot-api 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/turbot_api/api.rb +15 -35
- data/lib/turbot_api/version.rb +1 -1
- data/spec/api_spec.rb +1 -1
- metadata +6 -27
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OGRhMjY4YTc3MTZmZjc0MmQwYWI5YjQ1ZDhkZGE2OTFkMTM3YTAwZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzRhZTFkOGE4Zjg5NWVjMjViMmY0YTRkZmI2ZDBlNTZkY2VlZGUzYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjM4NmZmZDQwYTBlZjEwMjU2NDNmYjMzZGIwYzA2MTZmZmU3MjM0NTUyMTAy
|
10
|
+
MjNiNDE5MGY4YjhiYjVkMWQ3OWYwMTNiMDA3MWIxMTk2ODc4OTQyYjc4MGE1
|
11
|
+
MGI4NDk3ZDNjZTBjNjIyNjIwOTQyYzc1ZDQ4YTZhZThhMWQzMjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmE2ZTBlY2UyYWJhMzI5YzlhNmJhOWUxOTUxMGE2YWZkNDBkYWJlYTI5OGQ0
|
14
|
+
NWJiNzNmMDQyOTNmZGU0YzAzNWRhMWViNDZiZDM0MzUwOGEwMmRkMWNmNGFj
|
15
|
+
OTBhNjA2MTY2M2U3ZmUwOGNkZWU0Yzg1MzE2ZTE3NWIxNzA1YjA=
|
data/lib/turbot_api/api.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'action_dispatch'
|
2
1
|
require 'json'
|
3
2
|
require 'rest_client'
|
4
3
|
|
@@ -13,27 +12,6 @@ module Turbot
|
|
13
12
|
@scheme = params[:scheme]
|
14
13
|
@ssl_verify_peer = params[:ssl_verify_peer]
|
15
14
|
@api_key = params[:api_key] || get_api_key_for_credentials(@username, @password)["api_key"]
|
16
|
-
|
17
|
-
@routes = ActionDispatch::Routing::RouteSet.new
|
18
|
-
|
19
|
-
@routes.draw do
|
20
|
-
namespace :api do
|
21
|
-
resources :bots, :only => [:index, :create] do
|
22
|
-
resource :code, :only => [:update], :controller => 'code'
|
23
|
-
resource :draft_data, :only => [:update]
|
24
|
-
|
25
|
-
post 'run/start', :to => 'api/runs#start'
|
26
|
-
post 'run/stop', :to => 'api/runs#stop'
|
27
|
-
end
|
28
|
-
|
29
|
-
resource :user, :only => [:show] do
|
30
|
-
resource :api_key, :only => [:show]
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
@routes.default_url_options[:host] = @host
|
36
|
-
@routes.default_url_options[:port] = @port
|
37
15
|
end
|
38
16
|
|
39
17
|
def get_user
|
@@ -56,31 +34,31 @@ module Turbot
|
|
56
34
|
end
|
57
35
|
|
58
36
|
def list_bots
|
59
|
-
request(:get,
|
37
|
+
request(:get, "/api/bots")
|
60
38
|
end
|
61
39
|
|
62
40
|
def show_bot(bot_id)
|
63
|
-
request(:get,
|
41
|
+
request(:get, "/api/bots/#{bot_id}")
|
64
42
|
end
|
65
43
|
|
66
44
|
def create_bot(bot_id, config)
|
67
|
-
request(:post,
|
45
|
+
request(:post, "/api/bots", :bot => {:bot_id => bot_id, :config => config})
|
68
46
|
end
|
69
47
|
|
70
48
|
def update_draft_data(bot_id, config, batch)
|
71
|
-
request(:put,
|
49
|
+
request(:put, "/api/bots/#{bot_id}/draft_data", :config => config, :batch => batch)
|
72
50
|
end
|
73
51
|
|
74
52
|
def update_code(bot_id, archive)
|
75
|
-
request(:put,
|
53
|
+
request(:put, "/api/bots/#{bot_id}/code", :archive => archive)
|
76
54
|
end
|
77
55
|
|
78
56
|
def start_run(bot_id)
|
79
|
-
request(:post,
|
57
|
+
request(:post, "/api/bots/#{bot_id}/run/start")
|
80
58
|
end
|
81
59
|
|
82
60
|
def stop_run(bot_id)
|
83
|
-
request(:post,
|
61
|
+
request(:post, "/api/bots/#{bot_id}/run/stop")
|
84
62
|
end
|
85
63
|
|
86
64
|
def get_ssh_keys
|
@@ -106,12 +84,14 @@ module Turbot
|
|
106
84
|
URI::HTTP.build(args).to_s
|
107
85
|
end
|
108
86
|
|
109
|
-
def request(method,
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
87
|
+
def request(method, path, params={})
|
88
|
+
args = {
|
89
|
+
:host => @host,
|
90
|
+
:port => @port,
|
91
|
+
:scheme => @scheme,
|
92
|
+
:path => path.strip
|
93
|
+
}
|
94
|
+
url = URI::HTTP.build(args).to_s
|
115
95
|
|
116
96
|
begin
|
117
97
|
if method == :get
|
data/lib/turbot_api/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbot-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Turbot
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rest-client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rubyzip
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,27 +34,10 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: actionpack
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 4.0.3
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.0.3
|
62
41
|
description: Client library to deploy apps on Turbot.
|
63
42
|
email: support@opencorporates.com
|
64
43
|
executables: []
|
@@ -74,26 +53,26 @@ files:
|
|
74
53
|
homepage: http://opencorporates.com/
|
75
54
|
licenses:
|
76
55
|
- MIT
|
56
|
+
metadata: {}
|
77
57
|
post_install_message:
|
78
58
|
rdoc_options: []
|
79
59
|
require_paths:
|
80
60
|
- lib
|
81
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
62
|
requirements:
|
84
63
|
- - ! '>='
|
85
64
|
- !ruby/object:Gem::Version
|
86
65
|
version: '0'
|
87
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
67
|
requirements:
|
90
68
|
- - ! '>='
|
91
69
|
- !ruby/object:Gem::Version
|
92
70
|
version: '0'
|
93
71
|
requirements: []
|
94
72
|
rubyforge_project:
|
95
|
-
rubygems_version:
|
73
|
+
rubygems_version: 2.2.2
|
96
74
|
signing_key:
|
97
|
-
specification_version:
|
75
|
+
specification_version: 4
|
98
76
|
summary: Client library to deploy apps on Turbot.
|
99
77
|
test_files: []
|
78
|
+
has_rdoc:
|