Sha256: af357c0cb9c4456314455140a710a04c2d4385663dcc1f840613bcc986ac17f5

Contents?: true

Size: 995 Bytes

Versions: 9

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true

module CloudParty
  module Responses
    module Node
      class Account
        def initialize(account_hsh)
          @account = account_hsh
          @name = @account[:name]
          @id = @account[:id]
          @settings = @account[:settings]
        end

        attr_reader :name

        attr_reader :id

        def settings
          @settings.each do |k, v|
            settings << { k => v }
          end
        end

        def inspect
          outputs = []
          %i[id name settings].each do |var|
            if var == :settings
              settings = []
              @settings.each do |k, v|
                settings << "#{k}=#{v}"
              end
              outputs << "settings=[#{settings.join(', ')}]"
            else
              outputs << "#{var}=#{send(var)}"
            end
          end
          "#<Account #{outputs.join(', ')}>"
        end

        def to_s
          inspect
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cloud_party-0.1.7 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.6 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.5 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.4 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.3 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.2 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.1 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.1.pre.alpha.1 lib/cloud_party/responses/nodes/memberships/account.rb
cloud_party-0.1.0.pre.pre.1 lib/cloud_party/responses/nodes/memberships/account.rb