Class: StickyIoRestfulApiV2025731::AddressesController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::AddressesController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb
Overview
AddressesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_address(body, domain, v2_ext, contact_id) ⇒ ApiResponse
Create a new address by the customer ID **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | first_name | Optional | - | String | The first name.
-
#delete_address(domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Delete an existing address attached to the customer here here.
-
#get_address(domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Fetch a specific address object by ID.
-
#get_addresses(domain, v2_ext, contact_id) ⇒ ApiResponse
Fetch a list of all addresses by the contact ID **Response Data**\ Response parameters expected in address object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The ID.
-
#get_countries(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all countries **Response Data**\ Response parameters expected in country object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The country ID.
-
#get_country_s_states(domain, v2_ext, country_id) ⇒ ApiResponse
Fetch a list of all states by the country ID **Response Data**\ Response parameters expected in state object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | name | String | The state’s name.
-
#update_address(body, domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Update an existing address by the contact and address IDs **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | first_name | Optional | - | String | The first name.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from StickyIoRestfulApiV2025731::BaseController
Instance Method Details
#create_address(body, domain, v2_ext, contact_id) ⇒ ApiResponse
Create a new address by the customer ID **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | first_name | Optional | - | String | The first name. | last_name | Optional | - | Required | - | String | The last name. | email | Optional | - | String | The email. | phone | Required | - | String | The phone formatted. | street | Required | - | String | The street address. Address 1. | street_2 | Optional | - | String | The apartment, suite, unit number, or other address designation that is not part of the physical address. Address 2. | city | Required | - | String | The city. | state | Required | - | String | The state abbreviation. | zip | Required | - | String | The zip. | is_default | Optional | - | Integer Flag | Determines whether or not the address is set to be as default address. Default is 1 for a first address and 0 for any additional one. | allow_duplicates | Optional | true | Boolean Flag | Determines whether or not to allow the creation of duplicate address records for this contact. | country_id | Required | - | Integer | The country ID. description here here
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 192 def create_address(body, domain, v2_ext, contact_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}contacts/{contact_id}/addresses', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(contact_id, key: 'contact_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CreateAddressWithCustomEmail.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_address(domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Delete an existing address attached to the customer here here
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 230 def delete_address(domain, v2_ext, contact_id, address_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}contacts/{contact_id}/addresses/{address_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(contact_id, key: 'contact_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(address_id, key: 'address_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeleteAddress.method(:from_hash)) .is_api_response(true)) .execute end |
#get_address(domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Fetch a specific address object by ID. **Response Data**\ Response parameters expected in address object contained within the ‘data` field object: | Field | Data Type | Description | - | - | - | | id | Integer | The ID. | uuid | String | The UUID of the address object. | first_name | String | The first name. | last_name | String | The last name. | email | String | The email. | phone | String | The phone formatted. | phone_key | String | The phone unformatted. Digits only. | street | String | The street address. Address 1. | street_2 | String | The apartment, suite, unit number, or other address designation that is not part of the physical address. Address 2. | city | String | The city. | state | String | The state abbreviation. | zip | String | The zip. | is_default | Integer Flag | Determines whether or not the address is set to be as default address. | created_at | String | A timestamp that represents when the address was created. | updated_at | String | A timestamp that represents when the address was updated. | deleted_at | String | A timestamp that represents when the address was deleted. | country | String | The country abbreviation. | creator | Object | Object that contains data pertaining to the admin user that created the address. | creator.department_id | Integer | Department ID associated with the admin user. | creator.timezone | String | The admin user timezone. | creator.id | Integer | The admin user ID. | creator.is_active | Integer Flag | The admin user active status. | creator.name | String | The admin user name. | creator.email | String | The admin user email. | creator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. | updator | Object | Object that contains data pertaining to the admin user that last updated the address. | updator.department_id | Integer | Department ID associated with the admin user. | updator.timezone | String | The admin user timezone. | updator.id | Integer | The admin user ID. | updator.is_active | Integer Flag | The admin user active status. | updator.name | String | The admin user name. | updator.email | String | The admin user email. | updator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. here here
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 380 def get_address(domain, v2_ext, contact_id, address_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}contacts/{contact_id}/addresses/{address_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(contact_id, key: 'contact_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(address_id, key: 'address_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetAddress.method(:from_hash)) .is_api_response(true)) .execute end |
#get_addresses(domain, v2_ext, contact_id) ⇒ ApiResponse
Fetch a list of all addresses by the contact ID **Response Data**\ Response parameters expected in address object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The ID. | uuid | String | The UUID of the address object. | first_name | String | The first name. | last_name | String | The last name. | email | String | The email. | phone | String | The phone unformatted. | phone_key | String | The phone. Digits only. | street | String | The street address. Address 1. | street_2 | String | The apartment, suite, unit number, or other address designation that is not part of the physical address. Address 2. | city | String | The city. | state | String | The state abbreviation. | zip | String | The zip. | is_default | Integer Flag | Determines whether or not the address is set to be as default address. | created_at | String | A timestamp that represents when the address was created. | updated_at | String | A timestamp that represents when the address was updated. | deleted_at | String | A timestamp that represents when the address was deleted. | country | String | The country abbreviation. | creator | Object | Object that contains data pertaining to the admin user that created the address. | creator.department_id | Integer | Department ID associated with the admin user. | creator.timezone | String | The admin user timezone. | creator.id | Integer | The admin user ID. | creator.is_active | Integer Flag | The admin user active status. | creator.name | String | The admin user name. | creator.email | String | The admin user email. | creator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. | updator | Object | Object that contains data pertaining to the admin user that last updated the address. | updator.department_id | Integer | Department ID associated with the admin user. | updator.timezone | String | The admin user timezone. | updator.id | Integer | The admin user ID. | updator.is_active | Integer Flag | The admin user active status. | updator.name | String | The admin user name. | updator.email | String | The admin user email. | updator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. here
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 136 def get_addresses(domain, v2_ext, contact_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}contacts/{contact_id}/addresses', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(contact_id, key: 'contact_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetAddresses.method(:from_hash)) .is_api_response(true)) .execute end |
#get_countries(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all countries **Response Data**\ Response parameters expected in country object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The country ID. | name | String | The country’s name. | calling_code | String | The country’s calling code. | iso_numeric | Integer | The numeric ISO of the country. | iso_2 | String | The ISO 2 letters. Country abbreviation. | iso_3 | String | The ISO 3 letters.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 24 def get_countries(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}countries', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetCountries.method(:from_hash)) .is_api_response(true)) .execute end |
#get_country_s_states(domain, v2_ext, country_id) ⇒ ApiResponse
Fetch a list of all states by the country ID **Response Data**\ Response parameters expected in state object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | name | String | The state’s name. | value | String | The state abbreviation. here
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 58 def get_country_s_states(domain, v2_ext, country_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}countries/{country_id}/states', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(country_id, key: 'country_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#update_address(body, domain, v2_ext, contact_id, address_id) ⇒ ApiResponse
Update an existing address by the contact and address IDs **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | first_name | Optional | - | String | The first name. | last_name | Optional | - | Required | - | String | The last name. | email | Optional | - | String | The email. | phone | Optional | - | String | The phone formatted. | street | Optional | - | String | The street address. Address 1. | street_2 | Optional | - | String | The apartment, suite, unit number, or other address designation that is not part of the physical address. Address 2. | city | Optional | - | String | The city. | state | Optional | - | String | The state abbreviation. | zip | Optional | - | String | The zip. | is_default | Optional | - | Integer Flag | Determines whether or not the address is set to be as default address. Default is 1 for a first address and 0 for any additional one. | country_id | Optional | - | Integer | The country ID. description here here here
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/addresses_controller.rb', line 289 def update_address(body, domain, v2_ext, contact_id, address_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}contacts/{contact_id}/addresses/{address_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(contact_id, key: 'contact_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(address_id, key: 'address_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateAddress.method(:from_hash)) .is_api_response(true)) .execute end |