Namecheap.Contact (Namecheap v0.2.1) View Source
Contact/address information for a customer.
The purpose of this module is to construct request parameters for certain
API commands, like namecheap.domains.create
and namecheap.domains.setContacts
.
Link to this section Summary
Functions
Constructs request paramaters from a Namecheap.Contact
for use with certain
API commands.
Link to this section Types
Specs
t() :: %Namecheap.Contact{ address_line_1: String.t(), address_line_2: String.t() | nil, city: String.t() | nil, country: String.t(), email: String.t(), fax: String.t() | nil, first_name: String.t(), job_title: String.t() | nil, last_name: String.t(), organization_name: String.t() | nil, phone: String.t(), phone_ext: String.t() | nil, postal_code: String.t(), state_or_province: String.t() }
Link to this section Functions
Specs
to_params(t(), user_type :: String.t() | [String.t()]) :: Namecheap.params()
Constructs request paramaters from a Namecheap.Contact
for use with certain
API commands.
user_type
may be a string or list of strings.
In the case of multiple strings, a single map with all types will be created.
Example
iex(1)> contact = %Namecheap.Contact{first_name: "Herman", last_name: "Munster", email: "herman@munster.me", phone: "+001.1234567890", address_line_1: "1313 Mockingbird Lane", city: "Mockingbird Heights", state_or_province: "NY", postal_code: "12200", country: "United States"}
iex(2)> Namecheap.Contact.to_params(contact, "Registrant")
%{
"RegistrantAddress1" => "1313 Mockingbird Lane",
"RegistrantCity" => "Mockingbird Heights",
"RegistrantCountry" => "United States",
"RegistrantEmailAddress" => "herman@munster.me",
"RegistrantFirstName" => "Herman",
"RegistrantLastName" => "Munster",
"RegistrantPhone" => "+001.1234567890",
"RegistrantPostalCode" => "12200",
"RegistrantStateProvince" => "NY"
}
iex(3)> Namecheap.Contact.to_params(contact, ["Registrant", "Admin"])
%{
"RegistrantAddress1" => "1313 Mockingbird Lane",
"RegistrantCity" => "Mockingbird Heights",
"RegistrantCountry" => "United States",
"RegistrantEmailAddress" => "herman@munster.me",
"RegistrantFirstName" => "Herman",
"RegistrantLastName" => "Munster",
"RegistrantPhone" => "+001.1234567890",
"RegistrantPostalCode" => "12200",
"RegistrantStateProvince" => "NY",
"AdminAddress1" => "1313 Mockingbird Lane",
"AdminCity" => "Mockingbird Heights",
"AdminCountry" => "United States",
"AdminEmailAddress" => "herman@munster.me",
"AdminFirstName" => "Herman",
"AdminLastName" => "Munster",
"AdminPhone" => "+001.1234567890",
"AdminPostalCode" => "12200",
"AdminStateProvince" => "NY"
}