Class: SimpleSpark::Endpoints::SendingDomains

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_spark/endpoints/sending_domains.rb

Overview

Note:

Example sending domain { “domain”: “example1.com”, “tracking_domain”: “click.example1.com”, “status”: { “ownership_verified”: true, “spf_status”: “valid”, “abuse_at_status”: “valid”, “abuse_at_status”: “valid”, “dkim_status”: “valid”, “compliance_status”: “valid”, “postmaster_at_status”: “valid” } }

Provides access to the /sending-domains endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SendingDomains

Returns a new instance of SendingDomains.



12
13
14
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 12

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



10
11
12
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 10

def client
  @client
end

Instance Method Details

#create(values) ⇒ Object

Parameters:

  • domain_name (String)

    the domain name to create

  • tracking_domain (String)

    the domain name to track this domain against



27
28
29
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 27

def create(values)
  @client.call(method: :post, path: 'sending-domains', body_values: values)
end

#delete(domain_name) ⇒ Object

Parameters:

  • domain_name (String)

    the domain name to delete



68
69
70
71
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 68

def delete(domain_name)
  domain_name = @client.url_encode(domain_name)
  @client.call(method: :delete, path: "sending-domains/#{domain_name}")
end

#listArray

Returns:

  • (Array)

    a list of Sending Domain hash objects



19
20
21
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 19

def list
  @client.call(method: :get, path: 'sending-domains')
end

#retrieve(domain_name) ⇒ Hash

Parameters:

  • domain_name (String)

    the domain name to retrieve

Returns:

  • (Hash)

    an Sending Domain hash object



35
36
37
38
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 35

def retrieve(domain_name)
  domain_name = @client.url_encode(domain_name)
  @client.call(method: :get, path: "sending-domains/#{domain_name}")
end

#update(domain_name, values) ⇒ Object

Update a Sending Domain by its domain name

Parameters:

  • domain_name (String)

    the domain to update

  • values (Hash)

    the values to update the sending domain with



45
46
47
48
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 45

def update(domain_name, values)
  domain_name = @client.url_encode(domain_name)
  @client.call(method: :put, path: "sending-domains/#{domain_name}", body_values: values)
end

#verify(domain_name, values) ⇒ Object

Verify a Sending Domain by its domain name

Parameters:

  • domain_name (String)

    the domain to verify

  • values (Hash)

    the values specifying how to verify the domain Including the fields “dkim_verify” and/or “spf_verify” in the request initiates a check against the associated DNS record type for the specified sending domain.Including the fields “postmaster_at_verify” and/or “abuse_at_verify” in the request results in an email sent to the specified sending domain’s postmaster@ and/or abuse@ mailbox where a verification link can be clicked.Including the fields “postmaster_at_token” and/or “abuse_at_token” in the request initiates a check of the provided token(s) against the stored token(s) for the specified sending domain.



60
61
62
63
# File 'lib/simple_spark/endpoints/sending_domains.rb', line 60

def verify(domain_name, values)
  domain_name = @client.url_encode(domain_name)
  @client.call(method: :post, path: "sending-domains/#{domain_name}/verify", body_values: values)
end