Sha256: 90fe5bc5d7900cd5acd00cf9e5924df6f0e97296f7ceb5a635d4847e38f1a8ee

Contents?: true

Size: 925 Bytes

Versions: 118

Compression:

Stored size: 925 Bytes

Contents

module Awspec::Type
  class AccountAttribute < Base
    def initialize(key = nil)
      @key = key.to_sym
    end

    def resource_via_client
      attributes = nil
      Awspec::Helper::Type::ACCOUNT_ATTRIBUTES.each do |type|
        key = type.gsub(Awspec::Type::Account::REMOVE_SUFFIX_RE, '').to_sym
        next unless key == @key
        if key == 'ses'
          # https://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html
          next unless ['us-east-1', 'us-west-2', 'eu-west-1'].include?(Aws.config[:region])
        end
        eval "attributes = Awspec::Type::#{type.camelize}.new.resource_via_client"
      end
      @resource_via_client ||= attributes
    end

    def method_missing(name)
      name = name.to_s if name.class == Symbol
      describe = name.tr('-', '_').to_sym
      super unless resource_via_client.members.include?(describe)
      resource_via_client[describe]
    end
  end
end

Version data entries

118 entries across 118 versions & 4 rubygems

Version Path
awspec-1.25.1 lib/awspec/type/account_attribute.rb
awspec-1.25.0 lib/awspec/type/account_attribute.rb
awspec-1.24.4 lib/awspec/type/account_attribute.rb
awspec-1.24.3 lib/awspec/type/account_attribute.rb
awspec-1.24.2 lib/awspec/type/account_attribute.rb
awspec-1.24.1 lib/awspec/type/account_attribute.rb
awspec-1.24.0 lib/awspec/type/account_attribute.rb
awspec-1.23.0 lib/awspec/type/account_attribute.rb
awspec-1.22.1 lib/awspec/type/account_attribute.rb
awspec-1.22.0 lib/awspec/type/account_attribute.rb
awspec-1.21.1 lib/awspec/type/account_attribute.rb
awspec-1.21.0 lib/awspec/type/account_attribute.rb
awspec-1.20.0 lib/awspec/type/account_attribute.rb
awspec-1.19.2 lib/awspec/type/account_attribute.rb
awspec-1.19.1 lib/awspec/type/account_attribute.rb
awspec-1.19.0 lib/awspec/type/account_attribute.rb
cthiesfork-awspec-1.2.4 lib/awspec/type/account_attribute.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/type/account_attribute.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/type/account_attribute.rb
awspec-1.18.6 lib/awspec/type/account_attribute.rb