Skip to content

Commit

Permalink
Remove extra aliases (#168)
Browse files Browse the repository at this point in the history
Closes GH-114. This change makes the library
more consistent with other implementations.
  • Loading branch information
weppos committed May 21, 2018
1 parent 3775073 commit a4b653e
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 22 deletions.
1 change: 0 additions & 1 deletion lib/dnsimple/client/accounts.rb
Expand Up @@ -18,7 +18,6 @@ def accounts(options = {})

Dnsimple::Response.new(response, response["data"].map { |r| Struct::Account.new(r) })
end
alias list accounts
alias list_accounts accounts

end
Expand Down
1 change: 1 addition & 0 deletions lib/dnsimple/client/certificates.rb
Expand Up @@ -29,6 +29,7 @@ def certificates(account_id, domain_name, options = {})

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

# List ALL the certificates for the domain in the account.
#
Expand Down
5 changes: 0 additions & 5 deletions lib/dnsimple/client/contacts.rb
Expand Up @@ -29,7 +29,6 @@ def contacts(account_id, options = {})

Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Contact.new(r) })
end
alias list contacts
alias list_contacts contacts

# Lists ALL the contacts in the account.
Expand All @@ -54,7 +53,6 @@ def contacts(account_id, options = {})
def all_contacts(account_id, options = {})
paginate(:contacts, account_id, options)
end
alias all all_contacts

# Creates a contact in the account.
#
Expand All @@ -72,7 +70,6 @@ def create_contact(account_id, attributes, options = {})

Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
end
alias create create_contact

# Gets a contact from the account.
#
Expand Down Expand Up @@ -107,7 +104,6 @@ def update_contact(account_id, contact_id, attributes, options = {})

Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
end
alias update update_contact

# Deletes a contact from the account.
#
Expand All @@ -127,7 +123,6 @@ def delete_contact(account_id, contact_id, options = {})

Dnsimple::Response.new(response, nil)
end
alias delete delete_contact

end
end
Expand Down
4 changes: 0 additions & 4 deletions lib/dnsimple/client/domains.rb
Expand Up @@ -33,7 +33,6 @@ def domains(account_id, options = {})

Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Domain.new(r) })
end
alias list domains
alias list_domains domains

# Lists ALL the domains in the account.
Expand All @@ -59,7 +58,6 @@ def domains(account_id, options = {})
def all_domains(account_id, options = {})
paginate(:domains, account_id, options)
end
alias all all_domains

# Creates a domain in the account.
#
Expand All @@ -78,7 +76,6 @@ def create_domain(account_id, attributes, options = {})

Dnsimple::Response.new(response, Struct::Domain.new(response["data"]))
end
alias create create_domain

# Gets a domain from the account.
#
Expand Down Expand Up @@ -115,7 +112,6 @@ def delete_domain(account_id, domain_id, options = {})

Dnsimple::Response.new(response, nil)
end
alias delete delete_domain

# Resets the domain token.
#
Expand Down
2 changes: 0 additions & 2 deletions lib/dnsimple/client/services.rb
Expand Up @@ -28,7 +28,6 @@ def services(options = {})

Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) })
end
alias list services
alias list_services services

# Lists ALL the available one-click services.
Expand All @@ -55,7 +54,6 @@ def services(options = {})
def all_services(options = {})
paginate(:services, options)
end
alias all all_services

# Gets the service with specified ID.
#
Expand Down
3 changes: 0 additions & 3 deletions lib/dnsimple/client/webhooks.rb
Expand Up @@ -28,7 +28,6 @@ def webhooks(account_id, options = {})

Dnsimple::CollectionResponse.new(response, response["data"].map { |r| Struct::Webhook.new(r) })
end
alias list webhooks
alias list_webhooks webhooks

# Creates a webhook in the account.
Expand All @@ -47,7 +46,6 @@ def create_webhook(account_id, attributes, options = {})

Dnsimple::Response.new(response, Struct::Webhook.new(response["data"]))
end
alias create create_webhook

# Gets a webhook from the account.
#
Expand Down Expand Up @@ -84,7 +82,6 @@ def delete_webhook(account_id, webhook_id, options = {})

Dnsimple::Response.new(response, nil)
end
alias delete delete_webhook

end
end
Expand Down
1 change: 0 additions & 1 deletion lib/dnsimple/client/zones.rb
Expand Up @@ -33,7 +33,6 @@ def zones(account_id, options = {})

Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Zone.new(r) })
end
alias list zones
alias list_zones zones

# Lists ALL the zones in the account.
Expand Down
3 changes: 2 additions & 1 deletion lib/dnsimple/client/zones_records.rb
Expand Up @@ -30,11 +30,12 @@ module ZonesRecords
#
# @raise [Dnsimple::NotFoundError]
# @raise [Dnsimple::RequestError]
def list_zone_records(account_id, zone_id, options = {})
def zone_records(account_id, zone_id, options = {})
response = client.get(Client.versioned("/%s/zones/%s/records" % [account_id, zone_id]), Options::ListOptions.new(options))

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

# Lists ALL the zone records in the account.
#
Expand Down
10 changes: 5 additions & 5 deletions spec/dnsimple/client_spec.rb
Expand Up @@ -130,7 +130,7 @@
format: :json,
basic_auth: { username: "user", password: "pass" },
headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
)
)
.and_return(double('response', code: 200))

subject.request(:get, 'foo')
Expand All @@ -145,7 +145,7 @@
query: { foo: "bar" },
basic_auth: { username: "user", password: "pass" },
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT, "Custom" => "Header" }
)
)
.and_return(double('response', code: 200))

subject.request(:put, 'foo', { something: "else" }, { query: { foo: "bar" }, headers: { "Custom" => "Header" } })
Expand All @@ -159,7 +159,7 @@
body: { something: "else" },
basic_auth: { username: "user", password: "pass" },
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => Dnsimple::Default::USER_AGENT }
)
)
.and_return(double('response', code: 200))

subject.request(:post, 'foo', { something: "else" }, { headers: { "Content-Type" => "application/x-www-form-urlencoded" } })
Expand All @@ -173,7 +173,7 @@
http_proxyaddr: "example-proxy.com",
http_proxyport: "4321",
headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
)
)
.and_return(double('response', code: 200))

subject = described_class.new(proxy: "example-proxy.com:4321")
Expand All @@ -186,7 +186,7 @@
"#{subject.base_url}test",
format: :json,
headers: hash_including("User-Agent" => "#{Dnsimple::Default::USER_AGENT} customAgent")
)
)
.and_return(double("response", code: 200))

subject = described_class.new(user_agent: "customAgent")
Expand Down

0 comments on commit a4b653e

Please sign in to comment.