Class: MessenteApi::ContactsApi
- Inherits:
-
Object
- Object
- MessenteApi::ContactsApi
- Defined in:
- lib/messente_api/api/contacts_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_contact_to_group(group_id, phone, opts = {}) ⇒ Object
Adds a contact to a group.
-
#add_contact_to_group_with_http_info(group_id, phone, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Adds a contact to a group.
-
#create_contact(contact_fields, opts = {}) ⇒ ContactEnvelope
Creates a new contact.
-
#create_contact_with_http_info(contact_fields, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Creates a new contact.
-
#delete_contact(phone, opts = {}) ⇒ nil
Deletes a contact.
-
#delete_contact_with_http_info(phone, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Deletes a contact.
-
#fetch_contact(phone, opts = {}) ⇒ ContactEnvelope
Lists a contact.
-
#fetch_contact_groups(phone, opts = {}) ⇒ GroupListEnvelope
Lists groups of a contact.
-
#fetch_contact_groups_with_http_info(phone, opts = {}) ⇒ Array<(GroupListEnvelope, Integer, Hash)>
Lists groups of a contact.
-
#fetch_contact_with_http_info(phone, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Lists a contact.
-
#fetch_contacts(opts = {}) ⇒ ContactListEnvelope
Returns all contacts.
-
#fetch_contacts_with_http_info(opts = {}) ⇒ Array<(ContactListEnvelope, Integer, Hash)>
Returns all contacts.
-
#initialize(api_client = ApiClient.default) ⇒ ContactsApi
constructor
A new instance of ContactsApi.
-
#remove_contact_from_group(group_id, phone, opts = {}) ⇒ nil
Removes a contact from a group.
-
#remove_contact_from_group_with_http_info(group_id, phone, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Removes a contact from a group.
-
#update_contact(phone, contact_update_fields, opts = {}) ⇒ ContactEnvelope
Updates a contact.
-
#update_contact_with_http_info(phone, contact_update_fields, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Updates a contact.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ContactsApi
Returns a new instance of ContactsApi.
19 20 21 |
# File 'lib/messente_api/api/contacts_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/messente_api/api/contacts_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_contact_to_group(group_id, phone, opts = {}) ⇒ Object
Adds a contact to a group
27 28 29 30 |
# File 'lib/messente_api/api/contacts_api.rb', line 27 def add_contact_to_group(group_id, phone, opts = {}) data, _status_code, _headers = add_contact_to_group_with_http_info(group_id, phone, opts) data end |
#add_contact_to_group_with_http_info(group_id, phone, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Adds a contact to a group
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/messente_api/api/contacts_api.rb', line 37 def add_contact_to_group_with_http_info(group_id, phone, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.add_contact_to_group ...' end # verify the required parameter 'group_id' is set if @api_client.config.client_side_validation && group_id.nil? fail ArgumentError, "Missing the required parameter 'group_id' when calling ContactsApi.add_contact_to_group" end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.add_contact_to_group" end # resource path local_var_path = '/phonebook/groups/{groupId}/contacts/{phone}'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)).sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Object' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#add_contact_to_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_contact(contact_fields, opts = {}) ⇒ ContactEnvelope
Creates a new contact
92 93 94 95 |
# File 'lib/messente_api/api/contacts_api.rb', line 92 def create_contact(contact_fields, opts = {}) data, _status_code, _headers = create_contact_with_http_info(contact_fields, opts) data end |
#create_contact_with_http_info(contact_fields, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Creates a new contact
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/messente_api/api/contacts_api.rb', line 101 def create_contact_with_http_info(contact_fields, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_contact ...' end # verify the required parameter 'contact_fields' is set if @api_client.config.client_side_validation && contact_fields.nil? fail ArgumentError, "Missing the required parameter 'contact_fields' when calling ContactsApi.create_contact" end # resource path local_var_path = '/phonebook/contacts' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(contact_fields) # return_type return_type = opts[:return_type] || 'ContactEnvelope' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_contact(phone, opts = {}) ⇒ nil
Deletes a contact
154 155 156 157 |
# File 'lib/messente_api/api/contacts_api.rb', line 154 def delete_contact(phone, opts = {}) delete_contact_with_http_info(phone, opts) nil end |
#delete_contact_with_http_info(phone, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Deletes a contact
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/messente_api/api/contacts_api.rb', line 163 def delete_contact_with_http_info(phone, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.delete_contact ...' end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.delete_contact" end # resource path local_var_path = '/phonebook/contacts/{phone}'.sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#fetch_contact(phone, opts = {}) ⇒ ContactEnvelope
Lists a contact
214 215 216 217 |
# File 'lib/messente_api/api/contacts_api.rb', line 214 def fetch_contact(phone, opts = {}) data, _status_code, _headers = fetch_contact_with_http_info(phone, opts) data end |
#fetch_contact_groups(phone, opts = {}) ⇒ GroupListEnvelope
Lists groups of a contact
274 275 276 277 |
# File 'lib/messente_api/api/contacts_api.rb', line 274 def fetch_contact_groups(phone, opts = {}) data, _status_code, _headers = fetch_contact_groups_with_http_info(phone, opts) data end |
#fetch_contact_groups_with_http_info(phone, opts = {}) ⇒ Array<(GroupListEnvelope, Integer, Hash)>
Lists groups of a contact
283 284 285 286 287 288 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 322 323 324 325 326 327 328 |
# File 'lib/messente_api/api/contacts_api.rb', line 283 def fetch_contact_groups_with_http_info(phone, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contact_groups ...' end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.fetch_contact_groups" end # resource path local_var_path = '/phonebook/contacts/{phone}/groups'.sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GroupListEnvelope' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#fetch_contact_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#fetch_contact_with_http_info(phone, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Lists a contact
223 224 225 226 227 228 229 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 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/messente_api/api/contacts_api.rb', line 223 def fetch_contact_with_http_info(phone, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contact ...' end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.fetch_contact" end # resource path local_var_path = '/phonebook/contacts/{phone}'.sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ContactEnvelope' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#fetch_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#fetch_contacts(opts = {}) ⇒ ContactListEnvelope
Returns all contacts
334 335 336 337 |
# File 'lib/messente_api/api/contacts_api.rb', line 334 def fetch_contacts(opts = {}) data, _status_code, _headers = fetch_contacts_with_http_info(opts) data end |
#fetch_contacts_with_http_info(opts = {}) ⇒ Array<(ContactListEnvelope, Integer, Hash)>
Returns all contacts
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/messente_api/api/contacts_api.rb', line 343 def fetch_contacts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contacts ...' end # resource path local_var_path = '/phonebook/contacts' # query parameters query_params = opts[:query_params] || {} query_params[:'groupIds'] = @api_client.build_collection_param(opts[:'group_ids'], :multi) if !opts[:'group_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ContactListEnvelope' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#fetch_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_contact_from_group(group_id, phone, opts = {}) ⇒ nil
Removes a contact from a group
392 393 394 395 |
# File 'lib/messente_api/api/contacts_api.rb', line 392 def remove_contact_from_group(group_id, phone, opts = {}) remove_contact_from_group_with_http_info(group_id, phone, opts) nil end |
#remove_contact_from_group_with_http_info(group_id, phone, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Removes a contact from a group
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/messente_api/api/contacts_api.rb', line 402 def remove_contact_from_group_with_http_info(group_id, phone, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.remove_contact_from_group ...' end # verify the required parameter 'group_id' is set if @api_client.config.client_side_validation && group_id.nil? fail ArgumentError, "Missing the required parameter 'group_id' when calling ContactsApi.remove_contact_from_group" end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.remove_contact_from_group" end # resource path local_var_path = '/phonebook/groups/{groupId}/contacts/{phone}'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)).sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#remove_contact_from_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_contact(phone, contact_update_fields, opts = {}) ⇒ ContactEnvelope
Updates a contact
458 459 460 461 |
# File 'lib/messente_api/api/contacts_api.rb', line 458 def update_contact(phone, contact_update_fields, opts = {}) data, _status_code, _headers = update_contact_with_http_info(phone, contact_update_fields, opts) data end |
#update_contact_with_http_info(phone, contact_update_fields, opts = {}) ⇒ Array<(ContactEnvelope, Integer, Hash)>
Updates a contact
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/messente_api/api/contacts_api.rb', line 468 def update_contact_with_http_info(phone, contact_update_fields, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.update_contact ...' end # verify the required parameter 'phone' is set if @api_client.config.client_side_validation && phone.nil? fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.update_contact" end # verify the required parameter 'contact_update_fields' is set if @api_client.config.client_side_validation && contact_update_fields.nil? fail ArgumentError, "Missing the required parameter 'contact_update_fields' when calling ContactsApi.update_contact" end # resource path local_var_path = '/phonebook/contacts/{phone}'.sub('{' + 'phone' + '}', CGI.escape(phone.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(contact_update_fields) # return_type return_type = opts[:return_type] || 'ContactEnvelope' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |