Sha256: b13b57b27f54314478315ab0214226a73134e15ff29dcf286ac7d822c4720898

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 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 Brand < Fog::Model
        identity  :id, :type => :integer
        attribute :catalog_id, :aliases => 'catalogId', :type => :integer
        attribute :key_name, :aliases => 'keyName'
        attribute :long_name, :aliases => 'longName'
        attribute :name
        attribute :account

        def initialize(attributes = {})
          super(attributes)
        end

        def get_accounts
          service.get_brand_owned_accounts(id).body
        end

        def save
          return create if attributes[:id].nil?
          raise StandardError, "Update is not implemented"
        end

        def create
          template = create_template
          service.create_brand(template).body
        end

        private

        def create_template
          {
            keyName: attributes[:key_name],
            longName: attributes[:long_name],
            name: attributes[:name],
            account: attributes[: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/models/account/brand.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/account/brand.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.1.4 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.1.3 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.1.2 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.1.1 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.1.0 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.0.3 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.0.2 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.0.1 lib/fog/softlayer/models/account/brand.rb
fog-softlayer-1.0.0 lib/fog/softlayer/models/account/brand.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/models/account/brand.rb
fog-softlayer-0.4.7 lib/fog/softlayer/models/account/brand.rb