turbot-api 0.0.3 → 0.0.4
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 +8 -8
- data/lib/turbot_api/api.rb +12 -1
- data/lib/turbot_api/version.rb +1 -1
- data/spec/api_spec.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2JmZTI2YTYwMmNmYTc3YWQ2N2FlY2I4NjBmNjI3YTZkMDYxOWI3NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZThlMmExNzUyMGY5MmYwMzg4YzJjYzNmZjIyNmYwNWIzOWMwYzNkZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZThjZmMyNzkxNDJiZTYyZTQ2YjM5MDVlMWZkMDc1ZGUzNWVhNmZkNWQwNGJm
|
10
|
+
MzUzNmQyZmVlMGQxZTcyNTMwMGUzMjk1ZTg1MGQ1MzA2ZWU1YjY1MGRlZDk3
|
11
|
+
OTE4YTRiNjM2YjNlNTM2OWY1ZWU0OWFlMmE4MTIyOGRlZWE4NzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTI2NjJiMWI2ZGY2OGQ1M2FlMjU3YjY0MmFiNzdhZDdmNjUwYzEwZDU1ZmE0
|
14
|
+
OGFlODY3ZDJjOWZiODkxZGFjMTMzNzhlMTA5YTRkMzA5ZmU4ODI2MTA5MTQ2
|
15
|
+
N2IwOTc4OTFmODNjMjk0MTI3ZTg1YTgzNTVmNWJiMGFhNzRhOTY=
|
data/lib/turbot_api/api.rb
CHANGED
@@ -22,6 +22,9 @@ module Turbot
|
|
22
22
|
resources :bots, :only => [:index, :create] do
|
23
23
|
resource :code, :only => [:update], :controller => 'code'
|
24
24
|
resource :draft_data, :only => [:update]
|
25
|
+
|
26
|
+
post 'run/start', :to => 'api/runs#start'
|
27
|
+
post 'run/stop', :to => 'api/runs#stop'
|
25
28
|
end
|
26
29
|
|
27
30
|
resource :user, :only => [:show] do
|
@@ -73,6 +76,14 @@ module Turbot
|
|
73
76
|
request(:put, :bot_code, :bot_id => bot_id, :archive => archive)
|
74
77
|
end
|
75
78
|
|
79
|
+
def start_run(bot_id)
|
80
|
+
request(:post, :bot_run_start, :bot_id => bot_id)
|
81
|
+
end
|
82
|
+
|
83
|
+
def stop_run(bot_id)
|
84
|
+
request(:post, :bot_run_stop, :bot_id => bot_id)
|
85
|
+
end
|
86
|
+
|
76
87
|
def get_ssh_keys
|
77
88
|
[]
|
78
89
|
end
|
@@ -100,7 +111,7 @@ module Turbot
|
|
100
111
|
begin
|
101
112
|
url = @routes.url_helpers.send("api_#{named_route}_url")
|
102
113
|
rescue ActionController::UrlGenerationError
|
103
|
-
url = @routes.url_helpers.send("api_#{named_route}_url", :bot_id => params
|
114
|
+
url = @routes.url_helpers.send("api_#{named_route}_url", :bot_id => params.delete(:bot_id))
|
104
115
|
end
|
105
116
|
|
106
117
|
begin
|
data/lib/turbot_api/version.rb
CHANGED
data/spec/api_spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'turbot_api'
|
2
|
+
|
3
|
+
describe Turbot::API do
|
4
|
+
before do
|
5
|
+
@api = Turbot::API.new(:api_key => 'key', :host => 'http://example.com')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#start_run' do
|
9
|
+
it 'starts a run' do
|
10
|
+
RestClient.should_receive(:post).
|
11
|
+
with('http://example.com/api/bots/test-bot/run/start', :api_key => 'key').
|
12
|
+
and_return(double(:body => {}.to_json))
|
13
|
+
@api.start_run('test-bot')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#stop_run' do
|
18
|
+
it 'stops a run' do
|
19
|
+
RestClient.should_receive(:post).
|
20
|
+
with('http://example.com/api/bots/test-bot/run/stop', :api_key => 'key').
|
21
|
+
and_return(double(:body => {}.to_json))
|
22
|
+
@api.stop_run('test-bot')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbot-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Turbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/turbot_api/api.rb
|
64
64
|
- lib/turbot_api/errors.rb
|
65
65
|
- lib/turbot_api/version.rb
|
66
|
+
- spec/api_spec.rb
|
66
67
|
homepage: http://opencorporates.com/
|
67
68
|
licenses:
|
68
69
|
- MIT
|