Skip to content

Rework the account/settings endpoint #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions src/data/endpoints/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ description: >
Account endpoints provide a means of manipulating your account, including users,
OAuth Clients and Tokens, and Events.
endpoints:
/account/settings:
group: Settings
/account:
type: resource
description: >
Manage your account settings.
Managed account contact and billing information.
methods:
GET:
response: account
description: >
Returns your account settings.
examples:
curl: |
curl https://$api_root/$version/account/settings
python: |
my_settings = client.account.get_settings()
curl -H "Authorization: Bearer $TOKEN" \
https://$api_root/$version/account
PUT:
description: >
Edits your account settings.
Expand All @@ -36,23 +34,39 @@ endpoints:
"email": "[email protected]",
"first_name": "John",
"last_name": "Smith",
"network_helper": true,
"phone": "555-555-1212",
"state": "PA",
"zip": 19102,
}
}' \
https://$api_root/$version/account
/account/settings:
group: Settings
type: resource
description: >
Manage default settings for your account.
methods:
GET:
response: account_settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably include something like is_managed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

description: >
Returns your current defaults.
examples:
curl: |
curl -H "Authorization: Bearer $TOKEN" \
https://$api_root/$version/account/settings
PUT:
description: >
Edits your account's defaults.
examples:
curl: |
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PUT -d '{
"network_helper": true,
"longview_subscription": "longview-10"
}
}' \
https://$api_root/$version/account/settings
python: |
my_settings = client.account.get_settings()
my_settings.address_1 = '123 Main St.'
my_settings.address_2 = 'Suite 101'
my_settings.city = 'Philadelphia'
my_settings.company = 'My Company, LLC'
my_settings.country = 'US'
my_settings.email = '[email protected]'
my_settings.save()
/account/settings/managed-enable:
group: Settings
authenticated: true
Expand Down
63 changes: 28 additions & 35 deletions src/data/objects/account.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# vim: set et ts=2 sw=2 tw=80 :
name: Account
prefix: account/settings
prefix: account
description: >
A representation of account settings.
Your account contact and billing information.
schema:
first_name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing PUT output

type: String
description: This account holder's first name.
value: John
last_name:
type: String
description: This account holder's last name.
value: Smith
company:
type: String
description: This account's company name.
value: My Company LLC
address_1:
type: String
description: First line of this account's billing address.
Expand All @@ -14,12 +25,18 @@ schema:
value: Suite 101
city:
type: String
description: City portion of this account's billing address.
description: The city for this account's billing address.
value: Philadelphia
company:
state:
type: String
description: This account's company name.
value: My Company LLC
description: >
State portion of this account's billing address, or province if you
are outside of the United States.
value: PA
zip:
type: String
description: The zip code for this account's billing address.
value: 19102
country:
type: String
description: Country portion of this account's billing address.
Expand All @@ -28,41 +45,17 @@ schema:
type: String
description: Email address associated with the account.
value: [email protected]
first_name:
type: String
description: This account holder's first name.
value: John
last_name:
type: String
description: This account holder's last name.
value: Smith
network_helper:
type: Boolean
description: Enables network helper by default across all users.
value: true
phone:
type: String
description: Phone number associated with the account. Required format is 123-456-7890.
value: 555-555-1212
state:
type: String
description: State (or province) portion of this account's billing address.
value: PA
zip:
type: String
description: Zip Code portion of this account's billing address.
value: 19102
balance:
type: Float
description: This account's balance (in US Dollars).
value: 0.00
longview_subscription:
type: String
description: The Longview Pro tier you are currently subscribed to.
value: null
vat_number:
type: String
value: null
description: >
Your VAT identification number, for tax calculations in some countries. If
you do not live in a country that collects VAT, this should be null.
balance:
type: Float
description: This account's balance (in US Dollars).
value: 0.00
20 changes: 20 additions & 0 deletions src/data/objects/account_settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Account
prefix: account/settings
description: >
A representation of account settings.
schema:
network_helper:
type: Boolean
description: Enables network helper by default across all users.
value: true
editable: true
longview_subscription:
type: String
description: The Longview Pro tier you are currently subscribed to.
value: null
editable: true
managed:
type: Boolean
description: |
If this account subscribes to Linode Managed. To subscribe to managed,
POST to /account/settings/managed-enable