Class: StickyIoRestfulApiV2025731::ContactsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/controllers/contacts_controller.rb

Overview

ContactsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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

#get_contacts(search_created_at, domain, v2_ext) ⇒ ApiResponse

Fetch a list of all contacts **Response Data**\ Response parameters expected in contact object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The customer’s ID. | email | String | The customer’s email. | origin_id | Integer | The customer’s origin ID. | is_member | Integer Flag | Determines whether or not the customer is a member already. | created_at | String | A timestamp that represents when the customer was created. | first_name | String | The customer’s first name. | last_name | String | The customer’s last name. | phone | String | The customer’s phone unformatted. | phone_key | String | The customer’s phone. Digits only. | is_sms_communication_enabled | Integer Flag | Determines whether or not the customer’s sms communications is enabled. | custom_fields | Array | Array of custom fields objects associated with this customer. | custom_fields.*.id | Integer | The custom field ID. | custom_fields.*.field_type_id | Integer | The custom field’s field type ID. | custom_fields.*.name | String | The custom field name. | custom_fields.*.token_key | String | The custom field email token field. | custom_fields.*.is_multi | Integer Flag | Allow for multiple options to be selected. | custom_fields.*.options | Array | Array of option objects associated with the custom field. | custom_fields.*.options.*.id | Integer | The option ID. | custom_fields.*.options.*.value | String | The option value. | custom_fields.*.type_id | Integer | The custom field’s type ID. | addresses | Array | Array of addresses objects associated with this customer. | addresses.*.id | Integer | The ID. | addresses.*.uuid | String | The UUID of the address object. | addresses.*.first_name | String | The first name. | addresses.*.last_name | String | The last name. | addresses.*.email | String | The email. | addresses.*.phone | String | The phone unformatted. | addresses.*.phone_key | String | The phone. Digits only. | addresses.*.street | String | The street address. Address 1. | addresses.*.street_2 | String | The apartment, suite, unit number, or other address designation that is not part of the physical address. Address 2. | addresses.*.city | String | The city. | addresses.*.state | String | The state abbreviation. | addresses.*.zip | String | The zip. | addresses.*.is_default | Integer Flag | Determines whether or not the address is set to be as default address. | addresses.*.created_at | String | A timestamp that represents when the address was created. | addresses.*.updated_at | String | A timestamp that represents when the address was updated. | addresses.*.deleted_at | String | A timestamp that represents when the address was deleted. | addresses.*.country | String | The country abbreviation. | addresses.*.creator | Object | Object that contains data pertaining to the admin user that created the address. | addresses.*.creator.department_id | Integer | Department ID associated with the admin user. | addresses.*.creator.timezone | String | The admin user timezone. | addresses.*.creator.id | Integer | The admin user ID. | addresses.*.creator.is_active | Integer Flag | The admin user active status. | addresses.*.creator.name | String | The admin user name. | addresses.*.creator.email | String | The admin user email. | addresses.*.creator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. | addresses.*.updator | Object | Object that contains data pertaining to the admin user that last updated the address. | addresses.*.updator.department_id | Integer | Department ID associated with the admin user. | addresses.*.updator.timezone | String | The admin user timezone. | addresses.*.updator.id | Integer | The admin user ID. | addresses.*.updator.is_active | Integer Flag | The admin user active status. | addresses.*.updator.name | String | The admin user name. | addresses.*.updator.email | String | The admin user email. | addresses.*.updator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. | notes | Array | Array of notes objects associated with this customer. | notes.*.id | Integer | The note ID. | notes.*.value | Integer | The note value. | notes.*.created_at | String | A timestamp that represents when the note was created. | notes.*.updated_at | String | A timestamp that represents when the note was updated. | notes.*.deleted_at | String | A timestamp that represents when the note was deleted. | notes.*.creator | Object | Object that contains data pertaining to the admin user that created the note. | notes.*.creator.department_id | Integer | Department ID associated with the admin user. | notes.*.creator.timezone | String | The admin user timezone. | notes.*.creator.id | Integer | The admin user ID. | notes.*.creator.is_active | Integer Flag | The admin user active status. | notes.*.creator.name | String | The admin user name. | notes.*.creator.email | String | The admin user email. | notes.*.creator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. | notes.*.updator | Object | Object that contains data pertaining to the admin user that last updated the note. | notes.*.updator.department_id | Integer | Department ID associated with the admin user. | notes.*.updator.timezone | String | The admin user timezone. | notes.*.updator.id | Integer | The admin user ID. | notes.*.updator.is_active | Integer Flag | The admin user active status. | notes.*.updator.name | String | The admin user name. | notes.*.updator.email | String | The admin user email. | notes.*.updator.call_center_provider_id | Integer | The call center provider ID associated with the admin user. description here

Parameters:

  • search_created_at (SearchCreatedAt)

    Required parameter: TODO: type

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/sticky_io_restful_api_v2025731/controllers/contacts_controller.rb', line 130

def get_contacts(search_created_at,
                 domain,
                 v2_ext)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}contacts',
                                 Server::SERVER_1)
               .query_param(new_parameter(search_created_at, key: 'search[created_at]')
                             .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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('basic')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetContacts.method(:from_hash))
                .is_api_response(true))
    .execute
end