Skip to content

Commit

Permalink
Update "sid" identifier field
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Dec 12, 2016
1 parent 785c289 commit 5b49c60
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 29 deletions.
4 changes: 2 additions & 2 deletions lib/dnsimple/service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ defmodule Dnsimple.Service do

@type t :: %__MODULE__{
id: integer,
sid: String.t,
name: String.t,
short_name: String.t,
description: String.t,
setup_description: String.t,
default_subdomain: String.t,
Expand All @@ -38,7 +38,7 @@ defmodule Dnsimple.Service do
updated_at: String.t,
}

defstruct ~w(id name short_name description setup_description
defstruct ~w(id sid name description setup_description
default_subdomain requires_setup settings
created_at updated_at)a

Expand Down
4 changes: 2 additions & 2 deletions lib/dnsimple/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ defmodule Dnsimple.Template do

@type t :: %__MODULE__{
id: integer,
sid: String.t,
account_id: integer,
name: String.t,
short_name: String.t,
description: String.t,
created_at: String.t,
updated_at: String.t,
}

defstruct ~w(id account_id name short_name description
defstruct ~w(id sid account_id name description
created_at updated_at)a

end
10 changes: 5 additions & 5 deletions test/dnsimple/services_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ defmodule Dnsimple.ServicesTest do
data = response.data
assert data.__struct__ == Dnsimple.Service
assert data.id == 1
assert data.sid == "service1"
assert data.name == "Service 1"
assert data.short_name == "service1"
assert data.description == "First service example."
assert data.setup_description == nil
assert data.requires_setup == false
assert data.requires_setup == true
assert data.default_subdomain == nil
assert data.settings == []
assert data.created_at == "2014-02-14T19:15:19.953Z"
assert data.updated_at == "2016-03-04T09:23:27.655Z"
assert data.settings == [%Dnsimple.Service.Setting{append: ".service1.com", description: "Your Service 1 username is used to connect services to your account.", example: "username", label: "Service 1 Account Username", name: "username", password: false}]
assert data.created_at == "2014-02-14T19:15:19Z"
assert data.updated_at == "2016-03-04T09:23:27Z"
end
end

Expand Down
12 changes: 6 additions & 6 deletions test/dnsimple/templates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ defmodule Dnsimple.TemplatesTest do
data = response.data
assert data.__struct__ == Dnsimple.Template
assert data.id == 1
assert data.sid == "alpha"
assert data.account_id == @account_id
assert data.name == "Alpha"
assert data.short_name == "alpha"
assert data.description == "An alpha template."
assert data.created_at == "2016-03-22T11:08:58.262Z"
assert data.updated_at == "2016-03-22T11:08:58.262Z"
assert data.created_at == "2016-03-22T11:08:58Z"
assert data.updated_at == "2016-03-22T11:08:58Z"
end
end

Expand All @@ -87,7 +87,7 @@ defmodule Dnsimple.TemplatesTest do
url = "#{@client.base_url}/v2/#{@account_id}/templates"
method = "post"
fixture = "createTemplate/created.http"
attributes = %{name: "Beta", short_name: "beta", description: "A beta template."}
attributes = %{sid: "beta", name: "Beta", description: "A beta template."}
body = Poison.encode!(attributes)

use_cassette :stub, ExvcrUtils.response_fixture(fixture, method: method, url: url, request_body: body) do
Expand All @@ -106,7 +106,7 @@ defmodule Dnsimple.TemplatesTest do
url = "#{@client.base_url}/v2/#{@account_id}/templates/beta"
method = "patch"
fixture = "updateTemplate/success.http"
attributes = %{name: "Alpha", short_name: "alpha", description: "An alpha template."}
attributes = %{sid: "alpha", name: "Alpha", description: "An alpha template."}
body = Poison.encode!(attributes)

use_cassette :stub, ExvcrUtils.response_fixture(fixture, method: method, url: url, request_body: body) do
Expand All @@ -115,8 +115,8 @@ defmodule Dnsimple.TemplatesTest do

data = response.data
assert data.__struct__ == Dnsimple.Template
assert data.sid == "alpha"
assert data.name == "Alpha"
assert data.short_name == "alpha"
assert data.description == "An alpha template."
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures.http/appliedServices/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1,"name":"WordPress","short_name":"wordpress","description":"Share with the world, your community, or your closest friends.","setup_description":null,"requires_setup":true,"default_subdomain":"blog","created_at":"2013-11-05T18:06:50.968Z","updated_at":"2016-03-04T09:23:27.885Z","settings":[{"name":"site","label":"Site","append":null,"description":"Your Wordpress.com subdomain","example":null,"password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
{"data":[{"id":1,"name":"WordPress","sid":"wordpress","description":"Share with the world, your community, or your closest friends.","setup_description":null,"requires_setup":true,"default_subdomain":"blog","created_at":"2013-11-05T18:06:50Z","updated_at":"2016-03-04T09:23:27Z","settings":[{"name":"site","label":"Site","append":null,"description":"Your Wordpress.com subdomain","example":null,"password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
2 changes: 1 addition & 1 deletion test/fixtures.http/createTemplate/created.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: c4ab6dd9-87d4-4244-8ec8-9187a511b89c
X-Runtime: 0.115316
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Beta","short_name":"beta","description":"A beta template.","created_at":"2016-03-24T11:09:16.345Z","updated_at":"2016-03-24T11:09:16.345Z"}}
{"data":{"id":1,"account_id":1010,"name":"Beta","sid":"beta","description":"A beta template.","created_at":"2016-03-24T11:09:16Z","updated_at":"2016-03-24T11:09:16Z"}}
2 changes: 1 addition & 1 deletion test/fixtures.http/getService/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 741b849f-dba6-4d0b-a68c-f47fe1aa3a54
X-Runtime: 0.140632
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"name":"Service 1","short_name":"service1","description":"First service example.","setup_description":null,"requires_setup":false,"default_subdomain":null,"created_at":"2014-02-14T19:15:19.953Z","updated_at":"2016-03-04T09:23:27.655Z","settings":[]}}
{"data":{"id":1,"name":"Service 1","sid":"service1","description":"First service example.","setup_description":null,"requires_setup":true,"default_subdomain":null,"created_at":"2014-02-14T19:15:19Z","updated_at":"2016-03-04T09:23:27Z","settings":[{"name":"username","label":"Service 1 Account Username","append":".service1.com","description":"Your Service 1 username is used to connect services to your account.","example":"username","password":false}]}}
2 changes: 1 addition & 1 deletion test/fixtures.http/getTemplate/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 3401ffd6-730f-42c0-856c-3b270ca4b35f
X-Runtime: 0.938420
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Alpha","short_name":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"}}
{"data":{"id":1,"account_id":1010,"name":"Alpha","sid":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58Z","updated_at":"2016-03-22T11:08:58Z"}}
20 changes: 12 additions & 8 deletions test/fixtures.http/listServices/success.http
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 15 Apr 2016 14:57:44 GMT
Date: Sat, 10 Dec 2016 22:37:13 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2393
X-RateLimit-Reset: 1460735221
ETag: W/"0eae35f5ed682b90fe33b6e5809b2194"
X-RateLimit-Remaining: 2399
X-RateLimit-Reset: 1481413033
ETag: W/"65425ab4559f111f28bc952f3b672d48"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: e84f8594-f7a8-47d3-81f7-83f422107084
X-Runtime: 0.200949
X-Request-Id: 9a5dadcb-8e90-4fe9-ad60-be13ba3d3970
X-Runtime: 0.263229
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1,"name":"Service 1","short_name":"service1","description":"First service example.","setup_description":null,"requires_setup":false,"default_subdomain":null,"created_at":"2014-02-14T19:15:19.953Z","updated_at":"2016-03-04T09:23:27.655Z","settings":[]},{"id":2,"name":"Service 2","short_name":"service2","description":"Second service example.","setup_description":null,"requires_setup":true,"default_subdomain":null,"created_at":"2014-02-14T19:15:19.953Z","updated_at":"2016-03-04T09:23:27.655Z","settings":[{"name":"username","label":"Service 2 Account Username","append":".service2.com","description":"Your Service2 username is used to connect services to your account.","example":"username","password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
{"data":[{"id":1,"name":"Service 1","sid":"service1","description":"First service example.","setup_description":null,"requires_setup":false,"default_subdomain":null,"created_at":"2014-02-14T19:15:19Z","updated_at":"2016-03-04T09:23:27Z","settings":[]},{"id":2,"name":"Service 2","sid":"service2","description":"Second service example.","setup_description":null,"requires_setup":true,"default_subdomain":null,"created_at":"2014-02-14T19:15:19Z","updated_at":"2016-03-04T09:23:27Z","settings":[{"name":"username","label":"Service 2 Account Username","append":".service2.com","description":"Your Service2 username is used to connect services to your account.","example":"username","password":false}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
2 changes: 1 addition & 1 deletion test/fixtures.http/listTemplates/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 774e871f-8bda-40d7-bed9-bd907e872987
X-Runtime: 0.193956
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1,"account_id":1010,"name":"Alpha","short_name":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"},{"id":2,"account_id":1010,"name":"Beta","short_name":"beta","description":"A beta template.","created_at":"2016-03-22T11:11:26.342Z","updated_at":"2016-03-22T11:11:26.342Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
{"data":[{"id":1,"account_id":1010,"name":"Alpha","sid":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58Z","updated_at":"2016-03-22T11:08:58Z"},{"id":2,"account_id":1010,"name":"Beta","sid":"beta","description":"A beta template.","created_at":"2016-03-22T11:11:26Z","updated_at":"2016-03-22T11:11:26Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
2 changes: 1 addition & 1 deletion test/fixtures.http/updateTemplate/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ X-Request-Id: 3a7993e7-8b1e-47ce-a7a8-cc86b02904de
X-Runtime: 0.324954
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"Alpha","short_name":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"}}
{"data":{"id":1,"account_id":1010,"name":"Alpha","sid":"alpha","description":"An alpha template.","created_at":"2016-03-22T11:08:58.262Z","updated_at":"2016-03-22T11:08:58.262Z"}}

0 comments on commit 5b49c60

Please sign in to comment.