Sha256: c593fb8258388ea6b57448c692a84c839cfdee70504a6a6ebda6da73dd501b9f

Contents?: true

Size: 1014 Bytes

Versions: 14

Compression:

Stored size: 1014 Bytes

Contents

#
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

module Fog
  module Account
    class Softlayer
      class Mock
        # Get a Brand
        # @param [Integer] identifier
        # @return [Excon::Response]
        def get_brand(identifier)
          response = Excon::Response.new
          response.body = @brands.select {|brand| brand[:id] == identifier.to_i }.first || {}
          response.status = response.body.empty? ? 404 : 200
          if response.status == 404
            response.body = {
              "error" => "Unable to find object with id of '#{identifier}'.",
              "code"=>"SoftLayer_Exception_ObjectNotFound"
            }
          end
          response
        end
      end

      class Real
        def get_brand(identifier)
          request(:brand, identifier, :expected => [200, 404], :query => 'objectMask=mask[account]')
        end
      end
    end
  end
end

Version data entries

14 entries across 12 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/account/get_brand.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/account/get_brand.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.1.4 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.1.3 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.1.2 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.1.1 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.1.0 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.0.3 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.0.2 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.0.1 lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-1.0.0 lib/fog/softlayer/requests/account/get_brand.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/requests/account/get_brand.rb
fog-softlayer-0.4.7 lib/fog/softlayer/requests/account/get_brand.rb