class AWS::SimpleEmailService::IdentityCollection

Public Class Methods

new(options = {}) click to toggle source

@api private

Calls superclass method
# File lib/aws/simple_email_service/identity_collection.rb, line 21
def initialize options = {}
  @type = options[:type]
  super
end

Public Instance Methods

[](email_or_domain) click to toggle source

@param [String] email_or_domain @return [DomainIdentity,EmailIdentity] Returns an {Identity} with

the given email address or domain name.
# File lib/aws/simple_email_service/identity_collection.rb, line 46
def [] email_or_domain
  Identity.new(email_or_domain, :config => config)
end
create(email_or_domain)
Alias for: verify
domains() click to toggle source

@return [IdentityCollection] Returns a collection that only

enumerates domains.
# File lib/aws/simple_email_service/identity_collection.rb, line 58
def domains
  self.class.new(:type => 'Domain', :config => config)
end
email_addresses() click to toggle source

@return [IdentityCollection] Returns a collection that only

enumerates email addresses.
# File lib/aws/simple_email_service/identity_collection.rb, line 52
def email_addresses
  self.class.new(:type => 'EmailAddress', :config => config)
end
verify(email_or_domain) click to toggle source

Request verification for an email address or a domain. @param [String] email_or_domain @return [Identity] Returns an {Identity} object. Identities for

domains will have a #verification_token.
# File lib/aws/simple_email_service/identity_collection.rb, line 30
def verify email_or_domain

  resp = email_or_domain =~ /@/ ?
    client.verify_email_identity(:email_address => email_or_domain) :
    client.verify_domain_identity(:domain => email_or_domain)

  Identity.new(email_or_domain,
    :verification_token => resp.data[:verification_token],
    :config => config)

end
Also aliased as: create

Protected Instance Methods

_each_item(next_token, limit, options = {}) { |self| ... } click to toggle source
# File lib/aws/simple_email_service/identity_collection.rb, line 64
def _each_item next_token, limit, options = {}, &block

  options[:max_items] = limit if limit
  options[:next_token] = next_token if next_token
  options[:identity_type] = @type if @type

  resp = client.list_identities(options)
  resp.data[:identities].each do |identity|
    yield(self[identity])
  end

  resp.data[:next_token]

end