class Postmark::AccountApiClient

Public Class Methods

new(api_token, options = {}) click to toggle source
Calls superclass method
# File lib/postmark/account_api_client.rb, line 5
def initialize(api_token, options = {})
  options = options.dup
  options[:auth_header_name] = 'X-Postmark-Account-Token'
  super
end

Public Instance Methods

create_domain(attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 81
def create_domain(attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))

  format_response http_client.post('domains', data)
end
create_sender(attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 31
def create_sender(attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))

  format_response http_client.post('senders', data)
end
Also aliased as: create_signature
create_server(attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 129
def create_server(attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))
  format_response http_client.post('servers', data)
end
create_signature(attributes = {})
Alias for: create_sender
delete_domain(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 109
def delete_domain(id)
  format_response http_client.delete("domains/#{id.to_i}")
end
delete_sender(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 60
def delete_sender(id)
  format_response http_client.delete("senders/#{id.to_i}")
end
Also aliased as: delete_signature
delete_server(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 139
def delete_server(id)
  format_response http_client.delete("servers/#{id.to_i}")
end
delete_signature(id)
Alias for: delete_sender
domains(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 65
def domains(options = {})
  find_each('domains', 'Domains', options)
end
get_data_removal_status(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 149
def get_data_removal_status(id)
  format_response(http_client.get("data-removals/#{id}"))
end
get_domain(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 77
def get_domain(id)
  format_response http_client.get("domains/#{id.to_i}")
end
get_domains(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 69
def get_domains(options = {})
  load_batch('domains', 'Domains', options).last
end
get_domains_count(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 73
def get_domains_count(options = {})
  get_resource_count('domains', options)
end
get_sender(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 26
def get_sender(id)
  format_response http_client.get("senders/#{id.to_i}")
end
Also aliased as: get_signature
get_senders(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 16
def get_senders(options = {})
  load_batch('senders', 'SenderSignatures', options).last
end
Also aliased as: get_signatures
get_senders_count(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 21
def get_senders_count(options = {})
  get_resource_count('senders', options)
end
Also aliased as: get_signatures_count
get_server(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 125
def get_server(id)
  format_response http_client.get("servers/#{id.to_i}")
end
get_servers(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 117
def get_servers(options = {})
  load_batch('servers', 'Servers', options).last
end
get_servers_count(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 121
def get_servers_count(options = {})
  get_resource_count('servers', options)
end
get_signature(id)
Alias for: get_sender
get_signatures(options = {})
Alias for: get_senders
get_signatures_count(options = {})
Alias for: get_senders_count
push_templates(attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 143
def push_templates(attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))
  _, batch = format_batch_response(http_client.put('templates/push', data), "Templates")
  batch
end
request_data_removal(attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 153
def request_data_removal(attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))
  format_response(http_client.post('data-removals', data))
end
request_new_sender_dkim(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 55
def request_new_sender_dkim(id)
  format_response http_client.post("senders/#{id.to_i}/requestnewdkim")
end
Also aliased as: request_new_signature_dkim
request_new_signature_dkim(id)
resend_sender_confirmation(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 45
def resend_sender_confirmation(id)
  format_response http_client.post("senders/#{id.to_i}/resend")
end
resend_signature_confirmation(id)
rotate_domain_dkim(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 105
def rotate_domain_dkim(id)
  format_response http_client.post("domains/#{id.to_i}/rotatedkim")
end
senders(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 11
def senders(options = {})
  find_each('senders', 'SenderSignatures', options)
end
Also aliased as: signatures
servers(options = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 113
def servers(options = {})
  find_each('servers', 'Servers', options)
end
signatures(options = {})
Alias for: senders
update_domain(id, attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 87
def update_domain(id, attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))

  format_response http_client.put("domains/#{id.to_i}", data)
end
update_sender(id, attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 38
def update_sender(id, attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))

  format_response http_client.put("senders/#{id.to_i}", data)
end
Also aliased as: update_signature
update_server(id, attributes = {}) click to toggle source
# File lib/postmark/account_api_client.rb, line 134
def update_server(id, attributes = {})
  data = serialize(HashHelper.to_postmark(attributes))
  format_response http_client.put("servers/#{id.to_i}", data)
end
update_signature(id, attributes = {})
Alias for: update_sender
verified_domain_spf?(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 101
def verified_domain_spf?(id)
  !!http_client.post("domains/#{id.to_i}/verifyspf")['SPFVerified']
end
verified_sender_spf?(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 50
def verified_sender_spf?(id)
  !!http_client.post("senders/#{id.to_i}/verifyspf")['SPFVerified']
end
Also aliased as: verified_signature_spf?
verified_signature_spf?(id)
verify_domain_dkim(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 93
def verify_domain_dkim(id)
  format_response http_client.put("domains/#{id.to_i}/verifydkim")
end
verify_domain_return_path(id) click to toggle source
# File lib/postmark/account_api_client.rb, line 97
def verify_domain_return_path(id)
  format_response http_client.put("domains/#{id.to_i}/verifyreturnpath")
end