Class: AWS::SimpleEmailService::IdentityCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::Limitable
Defined in:
lib/aws/simple_email_service/identity_collection.rb

Instance Attribute Summary

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from Core::Collection::Limitable

#each_batch

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from Core::Model

#client, #config_prefix, #inspect

Constructor Details

#initialize(options = {}) ⇒ IdentityCollection

Returns a new instance of IdentityCollection.



21
22
23
24
# File 'lib/aws/simple_email_service/identity_collection.rb', line 21

def initialize options = {}
  @type = options[:type]
  super
end

Instance Method Details

#[](email_or_domain) ⇒ Identity

Returns an AWS::SimpleEmailService::Identity with the given email address or domain name.

Parameters:

  • email_or_domain (String)

Returns:



46
47
48
# File 'lib/aws/simple_email_service/identity_collection.rb', line 46

def [] email_or_domain
  Identity.new(email_or_domain, :config => config)
end

#domainsIdentityCollection

Returns a collection that only enumerates domains.

Returns:



58
59
60
# File 'lib/aws/simple_email_service/identity_collection.rb', line 58

def domains
  self.class.new(:type => 'Domain', :config => config)
end

#email_addressesIdentityCollection

Returns a collection that only enumerates email addresses.

Returns:



52
53
54
# 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) ⇒ Identity Also known as: create

Request verification for an email address or a domain.

Parameters:

  • email_or_domain (String)

Returns:

  • (Identity)

    Returns an Iidentity object. Identities for domains will have a #verification_token.



30
31
32
33
34
35
36
37
38
39
40
# 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