Skip to content

Commit 0174150

Browse files
Merge pull request sendinblue#17 from sendinblue/feature_updated_swagger_sync
Delete contact api added
2 parents 40edcc3 + 72459b3 commit 0174150

File tree

8 files changed

+159
-19
lines changed

8 files changed

+159
-19
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Class | Method | HTTP request | Description
9090
*SibApiV3Sdk::ContactsApi* | [**create_folder**](docs/ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
9191
*SibApiV3Sdk::ContactsApi* | [**create_list**](docs/ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
9292
*SibApiV3Sdk::ContactsApi* | [**delete_attribute**](docs/ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
93+
*SibApiV3Sdk::ContactsApi* | [**delete_contact**](docs/ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
9394
*SibApiV3Sdk::ContactsApi* | [**delete_folder**](docs/ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
9495
*SibApiV3Sdk::ContactsApi* | [**delete_list**](docs/ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
9596
*SibApiV3Sdk::ContactsApi* | [**get_attributes**](docs/ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes
@@ -355,3 +356,7 @@ If you find a bug, please post the issue on [Github](https://github.com/sendinbl
355356

356357
As always, if you need additional assistance, drop us a note [here](https://account.sendinblue.com/support).
357358

359+
## Recommendation
360+
361+
Please follow camelCase convention for variables in the API's. For example, use customVariable instead of custom_variable.
362+

docs/ContactsApi.md

+52
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**create_folder**](ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
1111
[**create_list**](ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
1212
[**delete_attribute**](ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
13+
[**delete_contact**](ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
1314
[**delete_folder**](ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
1415
[**delete_list**](ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
1516
[**get_attributes**](ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes
@@ -353,6 +354,57 @@ nil (empty response body)
353354

354355

355356

357+
# **delete_contact**
358+
> delete_contact(email)
359+
360+
Deletes a contact
361+
362+
### Example
363+
```ruby
364+
# load the gem
365+
require 'sib-api-v3-sdk'
366+
# setup authorization
367+
SibApiV3Sdk.configure do |config|
368+
# Configure API key authorization: api-key
369+
config.api_key['api-key'] = 'YOUR API KEY'
370+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
371+
#config.api_key_prefix['api-key'] = 'Bearer'
372+
end
373+
374+
api_instance = SibApiV3Sdk::ContactsApi.new
375+
376+
email = "email_example" # String | Email (urlencoded) of the contact
377+
378+
379+
begin
380+
#Deletes a contact
381+
api_instance.delete_contact(email)
382+
rescue SibApiV3Sdk::ApiError => e
383+
puts "Exception when calling ContactsApi->delete_contact: #{e}"
384+
end
385+
```
386+
387+
### Parameters
388+
389+
Name | Type | Description | Notes
390+
------------- | ------------- | ------------- | -------------
391+
**email** | **String**| Email (urlencoded) of the contact |
392+
393+
### Return type
394+
395+
nil (empty response body)
396+
397+
### Authorization
398+
399+
[api-key](../README.md#api-key)
400+
401+
### HTTP request headers
402+
403+
- **Content-Type**: application/json
404+
- **Accept**: application/json
405+
406+
407+
356408
# **delete_folder**
357409
> delete_folder(folder_id)
358410

docs/GetAccountPlan.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**type** | **String** | Displays the plan type of the user |
7-
**credits_type** | **String** | This is the type of the credit, \"User Limit\" or \"Send Limit\" are two possible types of credit of a user. \"User Limit\" implies the total number of subscribers you can add to your account, and \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. |
8-
**credits** | **Float** | Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan. |
9-
**start_date** | **Date** | Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
10-
**end_date** | **Date** | Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
7+
**credits_type** | **String** | This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. |
8+
**credits** | **Float** | Remaining credits of the user |
9+
**start_date** | **Date** | Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) | [optional]
10+
**end_date** | **Date** | Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) | [optional]
11+
**user_limit** | **Integer** | Only in case of reseller account. It implies the total number of child accounts you can add to your account. | [optional]
1112

1213

lib/sib-api-v3-sdk/api/contacts_api.rb

+54
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,60 @@ def delete_attribute_with_http_info(attribute_category, attribute_name, opts = {
380380
return data, status_code, headers
381381
end
382382

383+
# Deletes a contact
384+
#
385+
# @param email Email (urlencoded) of the contact
386+
# @param [Hash] opts the optional parameters
387+
# @return [nil]
388+
def delete_contact(email, opts = {})
389+
delete_contact_with_http_info(email, opts)
390+
return nil
391+
end
392+
393+
# Deletes a contact
394+
#
395+
# @param email Email (urlencoded) of the contact
396+
# @param [Hash] opts the optional parameters
397+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
398+
def delete_contact_with_http_info(email, opts = {})
399+
if @api_client.config.debugging
400+
@api_client.config.logger.debug "Calling API: ContactsApi.delete_contact ..."
401+
end
402+
# verify the required parameter 'email' is set
403+
if @api_client.config.client_side_validation && email.nil?
404+
fail ArgumentError, "Missing the required parameter 'email' when calling ContactsApi.delete_contact"
405+
end
406+
# resource path
407+
local_var_path = "/contacts/{email}".sub('{' + 'email' + '}', email.to_s)
408+
409+
# query parameters
410+
query_params = {}
411+
412+
# header parameters
413+
header_params = {}
414+
# HTTP header 'Accept' (if needed)
415+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
416+
# HTTP header 'Content-Type'
417+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
418+
419+
# form parameters
420+
form_params = {}
421+
422+
# http body (model)
423+
post_body = nil
424+
auth_names = ['api-key']
425+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
426+
:header_params => header_params,
427+
:query_params => query_params,
428+
:form_params => form_params,
429+
:body => post_body,
430+
:auth_names => auth_names)
431+
if @api_client.config.debugging
432+
@api_client.config.logger.debug "API called: ContactsApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
433+
end
434+
return data, status_code, headers
435+
end
436+
383437
# Delete a folder (and all its lists)
384438
#
385439
# @param folder_id Id of the folder

lib/sib-api-v3-sdk/models/get_account_plan.rb

+22-12
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ class GetAccountPlan
1818
# Displays the plan type of the user
1919
attr_accessor :type
2020

21-
# This is the type of the credit, \"User Limit\" or \"Send Limit\" are two possible types of credit of a user. \"User Limit\" implies the total number of subscribers you can add to your account, and \"Send Limit\" implies the total number of emails you can send to the subscribers in your account.
21+
# This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account.
2222
attr_accessor :credits_type
2323

24-
# Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan.
24+
# Remaining credits of the user
2525
attr_accessor :credits
2626

27-
# Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type)
27+
# Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type)
2828
attr_accessor :start_date
2929

30-
# Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type)
30+
# Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type)
3131
attr_accessor :end_date
3232

33+
# Only in case of reseller account. It implies the total number of child accounts you can add to your account.
34+
attr_accessor :user_limit
35+
3336
class EnumAttributeValidator
3437
attr_reader :datatype
3538
attr_reader :allowable_values
@@ -59,7 +62,8 @@ def self.attribute_map
5962
:'credits_type' => :'creditsType',
6063
:'credits' => :'credits',
6164
:'start_date' => :'startDate',
62-
:'end_date' => :'endDate'
65+
:'end_date' => :'endDate',
66+
:'user_limit' => :'userLimit'
6367
}
6468
end
6569

@@ -70,7 +74,8 @@ def self.swagger_types
7074
:'credits_type' => :'String',
7175
:'credits' => :'Float',
7276
:'start_date' => :'Date',
73-
:'end_date' => :'Date'
77+
:'end_date' => :'Date',
78+
:'user_limit' => :'Integer'
7479
}
7580
end
7681

@@ -102,6 +107,10 @@ def initialize(attributes = {})
102107
self.end_date = attributes[:'endDate']
103108
end
104109

110+
if attributes.has_key?(:'userLimit')
111+
self.user_limit = attributes[:'userLimit']
112+
end
113+
105114
end
106115

107116
# Show invalid properties with the reasons. Usually used together with valid?
@@ -127,10 +136,10 @@ def list_invalid_properties
127136
# @return true if the model is valid
128137
def valid?
129138
return false if @type.nil?
130-
type_validator = EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
139+
type_validator = EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
131140
return false unless type_validator.valid?(@type)
132141
return false if @credits_type.nil?
133-
credits_type_validator = EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
142+
credits_type_validator = EnumAttributeValidator.new('String', ["sendLimit"])
134143
return false unless credits_type_validator.valid?(@credits_type)
135144
return false if @credits.nil?
136145
return true
@@ -139,7 +148,7 @@ def valid?
139148
# Custom attribute writer method checking allowed values (enum).
140149
# @param [Object] type Object to be assigned
141150
def type=(type)
142-
validator = EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
151+
validator = EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
143152
unless validator.valid?(type)
144153
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
145154
end
@@ -149,7 +158,7 @@ def type=(type)
149158
# Custom attribute writer method checking allowed values (enum).
150159
# @param [Object] credits_type Object to be assigned
151160
def credits_type=(credits_type)
152-
validator = EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
161+
validator = EnumAttributeValidator.new('String', ["sendLimit"])
153162
unless validator.valid?(credits_type)
154163
fail ArgumentError, "invalid value for 'credits_type', must be one of #{validator.allowable_values}."
155164
end
@@ -165,7 +174,8 @@ def ==(o)
165174
credits_type == o.credits_type &&
166175
credits == o.credits &&
167176
start_date == o.start_date &&
168-
end_date == o.end_date
177+
end_date == o.end_date &&
178+
user_limit == o.user_limit
169179
end
170180

171181
# @see the `==` method
@@ -177,7 +187,7 @@ def eql?(o)
177187
# Calculates hash code according to all attributes.
178188
# @return [Fixnum] Hash code
179189
def hash
180-
[type, credits_type, credits, start_date, end_date].hash
190+
[type, credits_type, credits, start_date, end_date, user_limit].hash
181191
end
182192

183193
# Builds the object from hash

lib/sib-api-v3-sdk/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
=end
1212

1313
module SibApiV3Sdk
14-
VERSION = "4.0.0"
14+
VERSION = "4.0.1"
1515
end

spec/api/contacts_api_spec.rb

+12
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@
108108
end
109109
end
110110

111+
# unit tests for delete_contact
112+
# Deletes a contact
113+
#
114+
# @param email Email (urlencoded) of the contact
115+
# @param [Hash] opts the optional parameters
116+
# @return [nil]
117+
describe 'delete_contact test' do
118+
it "should work" do
119+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
120+
end
121+
end
122+
111123
# unit tests for delete_folder
112124
# Delete a folder (and all its lists)
113125
#

spec/models/get_account_plan_spec.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
describe 'test attribute "type"' do
3636
it 'should work' do
3737
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38-
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
38+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
3939
#validator.allowable_values.each do |value|
4040
# expect { @instance.type = value }.not_to raise_error
4141
#end
@@ -45,7 +45,7 @@
4545
describe 'test attribute "credits_type"' do
4646
it 'should work' do
4747
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
48-
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
48+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["sendLimit"])
4949
#validator.allowable_values.each do |value|
5050
# expect { @instance.credits_type = value }.not_to raise_error
5151
#end
@@ -70,5 +70,11 @@
7070
end
7171
end
7272

73+
describe 'test attribute "user_limit"' do
74+
it 'should work' do
75+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
76+
end
77+
end
78+
7379
end
7480

0 commit comments

Comments
 (0)