Module: TropoRest::Client::Address
- Included in:
- TropoRest::Client
- Defined in:
- lib/tropo_rest/client/address.rb
Constant Summary collapse
- SINGULAR_PATH =
"applications/%d/addresses/%s/%s".freeze
- PLURAL_PATH =
"applications/%d/addresses".freeze
- RESOURCE =
TropoRest::Resource::Address
Instance Method Summary collapse
-
#address(*args) ⇒ TropoRest::Resource::Address
Returns the specified address.
-
#addresses(application_id) ⇒ Array
Returns the addresses for the specified application.
-
#create_address(application_id_or_href, params = {}) ⇒ Hashie::Mash
Creates a new address for the specified application.
-
#delete_address(*args) ⇒ Hashie::Mash
Removes an address from an application.
Instance Method Details
#address(application_id, type, identifier) ⇒ TropoRest::Resource::Address #address(href) ⇒ TropoRest::Resource::Address
Returns the specified address
30 31 32 33 |
# File 'lib/tropo_rest/client/address.rb', line 30 def address(*args) path = get_path(SINGULAR_PATH, *args) get(path, RESOURCE) end |
#addresses(application_id) ⇒ Array
Returns the addresses for the specified application
15 16 17 18 |
# File 'lib/tropo_rest/client/address.rb', line 15 def addresses(application_id) path = get_path(PLURAL_PATH, application_id) get(path, RESOURCE) end |
#create_address(application_id_or_href, params = {}) ⇒ Hashie::Mash
Creates a new address for the specified application
53 54 55 56 |
# File 'lib/tropo_rest/client/address.rb', line 53 def create_address(application_id_or_href, params={}) path = get_path(PLURAL_PATH, application_id_or_href) post(path, RESOURCE.new(params)) end |
#delete_address(application_id, type, identifier) ⇒ Hashie::Mash #delete_address(href) ⇒ Hashie::Mash
Removes an address from an application
69 70 71 72 |
# File 'lib/tropo_rest/client/address.rb', line 69 def delete_address(*args) path = get_path(SINGULAR_PATH, *args) delete(path) end |