turbot-api 0.0.11 → 0.0.12

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjgxZTA3YTRhMjAxZjI4NWQ3OWM1OGI2MzBlOTE0NGE0MjNmOTgyNQ==
4
+ NGUyMWU1ZGQxNzU1N2EyZTVlM2JlMDYwYmQ1YmI4NDFjMTA3OTAzZA==
5
5
  data.tar.gz: !binary |-
6
- NGEwOTQzZmUzMDMyZDM4MzczYzVjMzk4MDJmOGM2MjJkN2IyYTNmYg==
6
+ ZTliMGM3OTc0ZWMxYTQ4MWY0ZjVlZTc1MzM3MDk3YjZiZDM3ZjcxYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDhkYWY1NDdlYTJmMTZkNTBmNTllYzk2ZGY0MzM4OThlYWZlMDAxYTE0N2Uy
10
- MjQ4ZGQzYjQ4YWY5YWI1NWI4MjU5ZTdmZTQ3YzU5ZDMwMjZmMGRlYzZjNTg3
11
- MDgzMjAyNzFlZGI4OGJlZDMwZmVjMWYyNWRiMmYzOGIyY2IyODE=
9
+ ZDFmMDAyYWRmYWJjYWNmM2NjYmJjNTg5Mzg5MGZlMzM4YzNiYmQ1ZjQyZDcz
10
+ ZGVjYmZlYmI5NThjMTAyYzFlOGNiMGJhMzQ5ZWQ4NjM2NjkxZjJiMjhiYWY5
11
+ ZDE3YmQ0NmE4NWI4ZmFlYzFiNmRhMDQxMzU0ODRlZTVkNDFiZTc=
12
12
  data.tar.gz: !binary |-
13
- NTU1YzVmNjRiNDYxMWVmM2U2NmJhMDgwZjhkOTA1MTBiOTE1MjRlZTRkMTRl
14
- ODExZTA5ZjFlOGUyZDJhN2Y5MGUzZmQ4MWUyZDczYWRmYmRiZjkyYmQwNWE4
15
- NDgxOTExODEyMzdhNTY4NmJjMjZmZjRlNzAzMTNmNjY2Njg3NmE=
13
+ NjJiZjM4ZGYwZTI2OGQzZjBjOTA5YWY0YjFiMDRhYzZhM2JiNGVkZmJkMjk3
14
+ OTQyNDMxYThmOGM1MGFhYWQzOTU0MDBmNmQxYzBlMWYyZWQyMjljNTg5YjJl
15
+ OGJlYTVhMmQ1NWM0MmYzYjA5ODE3MTI1NzY2ODM1NGVjNmQ5Y2I=
@@ -58,7 +58,14 @@ module Turbot
58
58
  end
59
59
 
60
60
  def update_code(bot_id, archive)
61
- request(:put, "/api/bots/#{bot_id}/code", :archive => archive)
61
+ # We can't use #request here since we're not sending JSON
62
+ url = build_url("/api/bots/#{bot_id}/code")
63
+ begin
64
+ response = RestClient.put(url, :api_key => @api_key, :archive => archive)
65
+ SuccessResponse.new(response)
66
+ rescue RestClient::Exception => e
67
+ FailureResponse.new(e.response)
68
+ end
62
69
  end
63
70
 
64
71
  def start_run(bot_id)
@@ -93,13 +100,7 @@ module Turbot
93
100
  end
94
101
 
95
102
  def request(method, path, params={})
96
- args = {
97
- :host => @host,
98
- :port => @port,
99
- :scheme => @scheme,
100
- :path => path.strip
101
- }
102
- url = URI::HTTP.build(args).to_s
103
+ url = build_url(path)
103
104
 
104
105
  begin
105
106
  if method == :get || method == :delete
@@ -113,6 +114,16 @@ module Turbot
113
114
  end
114
115
  end
115
116
 
117
+ def build_url(path)
118
+ args = {
119
+ :host => @host,
120
+ :port => @port,
121
+ :scheme => @scheme,
122
+ :path => path.strip
123
+ }
124
+ url = URI::HTTP.build(args).to_s
125
+ end
126
+
116
127
  class SuccessResponse
117
128
  attr_reader :message, :data
118
129
 
@@ -1,3 +1,3 @@
1
1
  module Turbot
2
- TURBOT_API_VERSION = "0.0.11"
2
+ TURBOT_API_VERSION = "0.0.12"
3
3
  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.11
4
+ version: 0.0.12
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-26 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client