Sha256: 77772ca3beffa9e4274fe7a8f6ec8afd812b9c9a2f2b16e4ffd1d6ddf5157d05

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

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 all brands who are owned by account.
        # @param [Integer] identifier
        # @return [Excon::Response]
        def get_account_owned_brands(identifier)
          response = Excon::Response.new
          response.status = 200
          response.body = mocked_brands
          if @accounts.select {|account| account['id'] == identifier.to_i }.empty?
            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_account_owned_brands(identifier)
          return request(:account, :getOwnedBrands) if identifier.nil?
          request(:account, "#{identifier}/getOwnedBrands")
        end
      end
    end
  end
end

module Fog
  module Account
    class Softlayer
      class Mock
        def mocked_brands
          [
            {
              "catalogId"=>14,
              "id"=>11111,
              "keyName"=>"NAME",
              "longName"=>"Name Name",
              "name"=>"Name"
            }
          ]
        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_account_owned_brands.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/account/get_account_owned_brands.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.1.4 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.1.3 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.1.2 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.1.1 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.1.0 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.0.3 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.0.2 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.0.1 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-1.0.0 lib/fog/softlayer/requests/account/get_account_owned_brands.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/requests/account/get_account_owned_brands.rb
fog-softlayer-0.4.7 lib/fog/softlayer/requests/account/get_account_owned_brands.rb