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 +8 -8
 - data/lib/turbot_api/api.rb +19 -8
 - data/lib/turbot_api/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NGUyMWU1ZGQxNzU1N2EyZTVlM2JlMDYwYmQ1YmI4NDFjMTA3OTAzZA==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                ZTliMGM3OTc0ZWMxYTQ4MWY0ZjVlZTc1MzM3MDk3YjZiZDM3ZjcxYw==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZDFmMDAyYWRmYWJjYWNmM2NjYmJjNTg5Mzg5MGZlMzM4YzNiYmQ1ZjQyZDcz
         
     | 
| 
      
 10 
     | 
    
         
            +
                ZGVjYmZlYmI5NThjMTAyYzFlOGNiMGJhMzQ5ZWQ4NjM2NjkxZjJiMjhiYWY5
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZDE3YmQ0NmE4NWI4ZmFlYzFiNmRhMDQxMzU0ODRlZTVkNDFiZTc=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                NjJiZjM4ZGYwZTI2OGQzZjBjOTA5YWY0YjFiMDRhYzZhM2JiNGVkZmJkMjk3
         
     | 
| 
      
 14 
     | 
    
         
            +
                OTQyNDMxYThmOGM1MGFhYWQzOTU0MDBmNmQxYzBlMWYyZWQyMjljNTg5YjJl
         
     | 
| 
      
 15 
     | 
    
         
            +
                OGJlYTVhMmQ1NWM0MmYzYjA5ODE3MTI1NzY2ODM1NGVjNmQ5Y2I=
         
     | 
    
        data/lib/turbot_api/api.rb
    CHANGED
    
    | 
         @@ -58,7 +58,14 @@ module Turbot 
     | 
|
| 
       58 
58 
     | 
    
         
             
                end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                def update_code(bot_id, archive)
         
     | 
| 
       61 
     | 
    
         
            -
                  request 
     | 
| 
      
 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 
     | 
    
         
            -
                   
     | 
| 
       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 
     | 
    
         | 
    
        data/lib/turbot_api/version.rb
    CHANGED
    
    
    
        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.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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-06-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rest-client
         
     |