stacker_bee 2.1.0.pre181 → 2.1.0.pre182
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/stacker_bee/builder.rb +21 -0
- data/lib/stacker_bee/client.rb +3 -20
- data/lib/stacker_bee/connection.rb +13 -9
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                Y2UwMzA1YjliY2I4MWI4YzkxOTNkMWI0MzcyYjljMTZjNWU1NjNlMA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                NDg2YzZlZDVjYzc4YWIxYTMzY2M3MmMxYjViODRjNTkwYzQ0NWM0OQ==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                ZjczNGY4NjU3N2JjY2M3OWZmYWJhOGE1ODIzMzM4ZDhiNGVjMTZiZGQxNjNh
         | 
| 10 | 
            +
                ZjBhNmQzYTJlOGNkNTEyY2RiZTZjNjJkOGVlNjFmZDVkYzE3MjJjZTJhZjg1
         | 
| 11 | 
            +
                ZTNmNTMyM2RmZWYyZTQ4ZmUyMGI2ZmVkZTFiNDFlZjk3ZDdjMTk=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ZmFjZGMzYzY0NDRlYzhhMDhjYzUzOGNkMTk4NjMyNTFjZTRjY2IzNzEyZjQ5
         | 
| 14 | 
            +
                ZmEyOTZiODY2Mjg0ODc2OTkwMzYzYjQ2MTU2ZWQzOTEzMjNkOGU1MTUyNGE3
         | 
| 15 | 
            +
                YzhjMDA4ZWFhODVkNjUwN2JjMWM5MzQwNjNmMTRlMzI1OTVlNmM=
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            module StackerBee
         | 
| 2 | 
            +
              class Builder
         | 
| 3 | 
            +
                attr_accessor :middlewares
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                def middlewares
         | 
| 6 | 
            +
                  @middlewares ||= []
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def use(*middleware_definition)
         | 
| 10 | 
            +
                  middlewares << middleware_definition
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def before(*middleware_definition)
         | 
| 14 | 
            +
                  middlewares.unshift middleware_definition
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def build
         | 
| 18 | 
            +
                  middlewares.map { |klass, *args| klass.new(*args) }
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
            end
         | 
    
        data/lib/stacker_bee/client.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            require "forwardable"
         | 
| 2 | 
            +
            require "stacker_bee/builder"
         | 
| 2 3 | 
             
            require "stacker_bee/configuration"
         | 
| 3 4 | 
             
            require "stacker_bee/api"
         | 
| 4 5 | 
             
            require "stacker_bee/connection"
         | 
| @@ -20,6 +21,7 @@ require "stacker_bee/middleware/raise_on_http_error" | |
| 20 21 | 
             
            require "stacker_bee/middleware/http_status"
         | 
| 21 22 | 
             
            require "stacker_bee/middleware/console_access"
         | 
| 22 23 |  | 
| 24 | 
            +
            # rubocop:disable ClassLength
         | 
| 23 25 | 
             
            module StackerBee
         | 
| 24 26 | 
             
              class Client
         | 
| 25 27 | 
             
                DEFAULT_API_PATH = File.join(
         | 
| @@ -35,6 +37,7 @@ module StackerBee | |
| 35 37 | 
             
                               :secret_key,
         | 
| 36 38 | 
             
                               :secret_key=
         | 
| 37 39 |  | 
| 40 | 
            +
                # rubocop:disable MethodLength
         | 
| 38 41 | 
             
                def middlewares
         | 
| 39 42 | 
             
                  # request
         | 
| 40 43 | 
             
                  builder.use Middleware::ConsoleAccess
         | 
| @@ -67,26 +70,6 @@ module StackerBee | |
| 67 70 | 
             
                  @builder ||= Builder.new
         | 
| 68 71 | 
             
                end
         | 
| 69 72 |  | 
| 70 | 
            -
                class Builder
         | 
| 71 | 
            -
                  attr_accessor :middlewares
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                  def middlewares
         | 
| 74 | 
            -
                    @middlewares ||= []
         | 
| 75 | 
            -
                  end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  def use(*middleware_definition)
         | 
| 78 | 
            -
                    middlewares << middleware_definition
         | 
| 79 | 
            -
                  end
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                  def before(*middleware_definition)
         | 
| 82 | 
            -
                    middlewares.unshift middleware_definition
         | 
| 83 | 
            -
                  end
         | 
| 84 | 
            -
             | 
| 85 | 
            -
                  def build
         | 
| 86 | 
            -
                    middlewares.map { |klass, *args| klass.new(*args) }
         | 
| 87 | 
            -
                  end
         | 
| 88 | 
            -
                end
         | 
| 89 | 
            -
             | 
| 90 73 | 
             
                class << self
         | 
| 91 74 | 
             
                  def reset!
         | 
| 92 75 | 
             
                    @api, @api_path, @default_config = nil
         | 
| @@ -11,20 +11,16 @@ module StackerBee | |
| 11 11 | 
             
                attr_accessor :configuration
         | 
| 12 12 |  | 
| 13 13 | 
             
                def initialize(configuration)
         | 
| 14 | 
            -
                   | 
| 14 | 
            +
                  self.configuration = configuration
         | 
| 15 15 |  | 
| 16 16 | 
             
                  uri = URI.parse(self.configuration.url)
         | 
| 17 17 | 
             
                  uri.path = ''
         | 
| 18 18 | 
             
                  fail ConnectionError, "no protocol specified" unless uri.scheme
         | 
| 19 19 |  | 
| 20 | 
            -
                   | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                               end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                  initialize_faraday(url: uri.to_s,
         | 
| 27 | 
            -
                                     ssl: { verify: ssl_verify })
         | 
| 20 | 
            +
                  initialize_faraday(
         | 
| 21 | 
            +
                    url: uri.to_s,
         | 
| 22 | 
            +
                    ssl: { verify: ssl_verify? }
         | 
| 23 | 
            +
                  )
         | 
| 28 24 | 
             
                end
         | 
| 29 25 |  | 
| 30 26 | 
             
                def initialize_faraday(options)
         | 
| @@ -52,5 +48,13 @@ module StackerBee | |
| 52 48 | 
             
                  raise ConnectionError,
         | 
| 53 49 | 
             
                        "Failed to connect to #{configuration.url}, #{error}"
         | 
| 54 50 | 
             
                end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                def ssl_verify?
         | 
| 53 | 
            +
                  if !configuration.ssl_verify.nil?
         | 
| 54 | 
            +
                    configuration.ssl_verify
         | 
| 55 | 
            +
                  else
         | 
| 56 | 
            +
                    true
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
                end
         | 
| 55 59 | 
             
              end
         | 
| 56 60 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stacker_bee
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.1.0. | 
| 4 | 
            +
              version: 2.1.0.pre182
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Greg Sterndale
         | 
| @@ -179,6 +179,7 @@ files: | |
| 179 179 | 
             
            - lib/faraday_middleware/response/graylog.rb
         | 
| 180 180 | 
             
            - lib/stacker_bee.rb
         | 
| 181 181 | 
             
            - lib/stacker_bee/api.rb
         | 
| 182 | 
            +
            - lib/stacker_bee/builder.rb
         | 
| 182 183 | 
             
            - lib/stacker_bee/client.rb
         | 
| 183 184 | 
             
            - lib/stacker_bee/configuration.rb
         | 
| 184 185 | 
             
            - lib/stacker_bee/connection.rb
         |