Module: Dnsimple::Client::DomainsPushes

Included in:
DomainsService
Defined in:
lib/dnsimple/client/domains_pushes.rb

Instance Method Summary collapse

Instance Method Details

#accept_push(account_id, push_id, attributes, options = {}) ⇒ Dnsimple::Response<nil>

Accept a domain push.

Examples:

Accept a domain push in the target account:

client.domains.accept_push(2020, 1, contact_id: 2)

Parameters:

  • account_id (Integer)

    the target account ID

  • push_id (Integer)

    the domain push ID

  • options (Hash) (defaults to: {})
  • attributes (Hash)

Options Hash (attributes):

  • :contact_id (Integer)

    the contact ID (mandatory)

Returns:

Raises:

See Also:



69
70
71
72
73
74
# File 'lib/dnsimple/client/domains_pushes.rb', line 69

def accept_push(, push_id, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:contact_id])
  response = client.post(Client.versioned("/%s/pushes/%s" % [, push_id]), attributes, options)

  Dnsimple::Response.new(response, nil)
end

#initiate_push(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::DomainPush>

Initiate a push for the domain.

Examples:

Initiate a domain pushe for example.com:

client.domains.initiate_push(1010, "example.com", new_account_email: "[email protected]")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    The domain ID or domain name

  • attributes (Hash)
  • options (Hash) (defaults to: {})

Options Hash (attributes):

  • :new_account_email (String)

    the target account email (mandatory)

Returns:

Raises:

See Also:



22
23
24
25
26
27
# File 'lib/dnsimple/client/domains_pushes.rb', line 22

def initiate_push(, domain_id, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:new_account_email])
  response = client.post(Client.versioned("/%s/domains/%s/pushes" % [, domain_id]), attributes, options)

  Dnsimple::Response.new(response, Struct::DomainPush.new(response["data"]))
end

#pushes(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::DomainPush>

Lists the pushes for the domain.

Examples:

List domain pushes in the first page

client.domains.pushes(2020)

List domain pushes, provide a specific page

client.domains.pushes(2020, page: 2)

Parameters:

  • account_id (Integer)

    the account ID

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

Returns:

Raises:

See Also:



47
48
49
50
51
# File 'lib/dnsimple/client/domains_pushes.rb', line 47

def pushes(, options = {})
  response = client.get(Client.versioned("/%s/pushes" % []), Options::ListOptions.new(options))

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::DomainPush.new(r) })
end

#reject_push(account_id, push_id, options = {}) ⇒ Dnsimple::Response<nil>

Reject a domain push.

Examples:

Reject a domain push in the target account:

client.domains.reject_push(2020, 1, contact_id: 2)

Parameters:

  • account_id (Integer)

    the target account ID

  • push_id (Integer)

    the domain push ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



90
91
92
93
94
# File 'lib/dnsimple/client/domains_pushes.rb', line 90

def reject_push(, push_id, options = {})
  response = client.delete(Client.versioned("/%s/pushes/%s" % [, push_id]), options)

  Dnsimple::Response.new(response, nil)
end