Class: Mailtrap::CompanyInfoAPI

Inherits:
Object
  • Object
show all
Includes:
BaseAPI
Defined in:
lib/mailtrap/company_info_api.rb

Instance Attribute Summary

Attributes included from BaseAPI

#account_id, #client

Instance Method Summary collapse

Methods included from BaseAPI

included, #initialize

Instance Method Details

#create(sending_domain_id, options) ⇒ CompanyInfo

Creates company information for a sending domain

Parameters:

  • sending_domain_id (Integer)

    The sending domain ID

  • options (Hash)

    The company info attributes

Options Hash (options):

  • :name (String)

    Company or individual name

  • :address (String)

    Street address

  • :city (String)

    City

  • :country (String)

    Country

  • :phone (String)

    Phone number

  • :zip_code (String)

    ZIP or postal code

  • :privacy_policy_url (String)

    URL to the privacy policy page

  • :terms_of_service_url (String)

    URL to the terms of service page

  • :website_url (String)

    Company website URL

  • :info_level (String)

    Whether the sender is a “business” or “individual”

Returns:

Raises:



50
51
52
53
54
# File 'lib/mailtrap/company_info_api.rb', line 50

def create(sending_domain_id, options)
  validate_options!(options, supported_options)
  response = client.post(base_path(sending_domain_id), wrap_request(options))
  build_entity(response[:data], CompanyInfo)
end

#get(sending_domain_id) ⇒ CompanyInfo

Gets company information for a sending domain

Parameters:

  • sending_domain_id (Integer)

    The sending domain ID

Returns:

Raises:



29
30
31
32
# File 'lib/mailtrap/company_info_api.rb', line 29

def get(sending_domain_id)
  response = client.get(base_path(sending_domain_id))
  build_entity(response[:data], CompanyInfo)
end

#update(sending_domain_id, options) ⇒ CompanyInfo

Updates company information for a sending domain

Parameters:

  • sending_domain_id (Integer)

    The sending domain ID

  • options (Hash)

    The company info attributes to update

Returns:

Raises:



62
63
64
65
66
# File 'lib/mailtrap/company_info_api.rb', line 62

def update(sending_domain_id, options)
  validate_options!(options, supported_options)
  response = client.patch(base_path(sending_domain_id), wrap_request(options))
  build_entity(response[:data], CompanyInfo)
end