Skip to content

Commit

Permalink
Merge pull request #17 from sendinblue/feature_updated_swagger_sync
Browse files Browse the repository at this point in the history
Delete contact api added
  • Loading branch information
aakanksha-sib authored Apr 16, 2018
2 parents 40edcc3 + 72459b3 commit 0174150
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 19 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Class | Method | HTTP request | Description
*SibApiV3Sdk::ContactsApi* | [**create_folder**](docs/ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
*SibApiV3Sdk::ContactsApi* | [**create_list**](docs/ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
*SibApiV3Sdk::ContactsApi* | [**delete_attribute**](docs/ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
*SibApiV3Sdk::ContactsApi* | [**delete_contact**](docs/ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
*SibApiV3Sdk::ContactsApi* | [**delete_folder**](docs/ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
*SibApiV3Sdk::ContactsApi* | [**delete_list**](docs/ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
*SibApiV3Sdk::ContactsApi* | [**get_attributes**](docs/ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes
Expand Down Expand Up @@ -355,3 +356,7 @@ If you find a bug, please post the issue on [Github](https://github.com/sendinbl

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

## Recommendation

Please follow camelCase convention for variables in the API's. For example, use customVariable instead of custom_variable.

52 changes: 52 additions & 0 deletions docs/ContactsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Method | HTTP request | Description
[**create_folder**](ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
[**create_list**](ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
[**delete_attribute**](ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
[**delete_contact**](ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
[**delete_folder**](ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
[**delete_list**](ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
[**get_attributes**](ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes
Expand Down Expand Up @@ -353,6 +354,57 @@ nil (empty response body)



# **delete_contact**
> delete_contact(email)
Deletes a contact

### Example
```ruby
# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
# Configure API key authorization: api-key
config.api_key['api-key'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = SibApiV3Sdk::ContactsApi.new

email = "email_example" # String | Email (urlencoded) of the contact


begin
#Deletes a contact
api_instance.delete_contact(email)
rescue SibApiV3Sdk::ApiError => e
puts "Exception when calling ContactsApi->delete_contact: #{e}"
end
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**email** | **String**| Email (urlencoded) of the contact |

### Return type

nil (empty response body)

### Authorization

[api-key](../README.md#api-key)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json



# **delete_folder**
> delete_folder(folder_id)
Expand Down
9 changes: 5 additions & 4 deletions docs/GetAccountPlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **String** | Displays the plan type of the user |
**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. |
**credits** | **Float** | Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan. |
**start_date** | **Date** | Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
**end_date** | **Date** | Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
**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. |
**credits** | **Float** | Remaining credits of the user |
**start_date** | **Date** | Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) | [optional]
**end_date** | **Date** | Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) | [optional]
**user_limit** | **Integer** | Only in case of reseller account. It implies the total number of child accounts you can add to your account. | [optional]


54 changes: 54 additions & 0 deletions lib/sib-api-v3-sdk/api/contacts_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,60 @@ def delete_attribute_with_http_info(attribute_category, attribute_name, opts = {
return data, status_code, headers
end

# Deletes a contact
#
# @param email Email (urlencoded) of the contact
# @param [Hash] opts the optional parameters
# @return [nil]
def delete_contact(email, opts = {})
delete_contact_with_http_info(email, opts)
return nil
end

# Deletes a contact
#
# @param email Email (urlencoded) of the contact
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
def delete_contact_with_http_info(email, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: ContactsApi.delete_contact ..."
end
# verify the required parameter 'email' is set
if @api_client.config.client_side_validation && email.nil?
fail ArgumentError, "Missing the required parameter 'email' when calling ContactsApi.delete_contact"
end
# resource path
local_var_path = "/contacts/{email}".sub('{' + 'email' + '}', email.to_s)

# query parameters
query_params = {}

# header parameters
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 = {}

# http body (model)
post_body = nil
auth_names = ['api-key']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
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

# Delete a folder (and all its lists)
#
# @param folder_id Id of the folder
Expand Down
34 changes: 22 additions & 12 deletions lib/sib-api-v3-sdk/models/get_account_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ class GetAccountPlan
# Displays the plan type of the user
attr_accessor :type

# 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.
# 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.
attr_accessor :credits_type

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

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

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

# Only in case of reseller account. It implies the total number of child accounts you can add to your account.
attr_accessor :user_limit

class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
Expand Down Expand Up @@ -59,7 +62,8 @@ def self.attribute_map
:'credits_type' => :'creditsType',
:'credits' => :'credits',
:'start_date' => :'startDate',
:'end_date' => :'endDate'
:'end_date' => :'endDate',
:'user_limit' => :'userLimit'
}
end

Expand All @@ -70,7 +74,8 @@ def self.swagger_types
:'credits_type' => :'String',
:'credits' => :'Float',
:'start_date' => :'Date',
:'end_date' => :'Date'
:'end_date' => :'Date',
:'user_limit' => :'Integer'
}
end

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

if attributes.has_key?(:'userLimit')
self.user_limit = attributes[:'userLimit']
end

end

# Show invalid properties with the reasons. Usually used together with valid?
Expand All @@ -127,10 +136,10 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
return false if @type.nil?
type_validator = EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
type_validator = EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
return false unless type_validator.valid?(@type)
return false if @credits_type.nil?
credits_type_validator = EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
credits_type_validator = EnumAttributeValidator.new('String', ["sendLimit"])
return false unless credits_type_validator.valid?(@credits_type)
return false if @credits.nil?
return true
Expand All @@ -139,7 +148,7 @@ def valid?
# Custom attribute writer method checking allowed values (enum).
# @param [Object] type Object to be assigned
def type=(type)
validator = EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
validator = EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
unless validator.valid?(type)
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
end
Expand All @@ -149,7 +158,7 @@ def type=(type)
# Custom attribute writer method checking allowed values (enum).
# @param [Object] credits_type Object to be assigned
def credits_type=(credits_type)
validator = EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
validator = EnumAttributeValidator.new('String', ["sendLimit"])
unless validator.valid?(credits_type)
fail ArgumentError, "invalid value for 'credits_type', must be one of #{validator.allowable_values}."
end
Expand All @@ -165,7 +174,8 @@ def ==(o)
credits_type == o.credits_type &&
credits == o.credits &&
start_date == o.start_date &&
end_date == o.end_date
end_date == o.end_date &&
user_limit == o.user_limit
end

# @see the `==` method
Expand All @@ -177,7 +187,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[type, credits_type, credits, start_date, end_date].hash
[type, credits_type, credits, start_date, end_date, user_limit].hash
end

# Builds the object from hash
Expand Down
2 changes: 1 addition & 1 deletion lib/sib-api-v3-sdk/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module SibApiV3Sdk
VERSION = "4.0.0"
VERSION = "4.0.1"
end
12 changes: 12 additions & 0 deletions spec/api/contacts_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
end
end

# unit tests for delete_contact
# Deletes a contact
#
# @param email Email (urlencoded) of the contact
# @param [Hash] opts the optional parameters
# @return [nil]
describe 'delete_contact test' do
it "should work" do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end

# unit tests for delete_folder
# Delete a folder (and all its lists)
#
Expand Down
10 changes: 8 additions & 2 deletions spec/models/get_account_plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
describe 'test attribute "type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"])
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["payAsYouGo", "free", "subscription", "sms", "reseller"])
#validator.allowable_values.each do |value|
# expect { @instance.type = value }.not_to raise_error
#end
Expand All @@ -45,7 +45,7 @@
describe 'test attribute "credits_type"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["userLimit", "sendLimit"])
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["sendLimit"])
#validator.allowable_values.each do |value|
# expect { @instance.credits_type = value }.not_to raise_error
#end
Expand All @@ -70,5 +70,11 @@
end
end

describe 'test attribute "user_limit"' do
it 'should work' do
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
end
end

end

0 comments on commit 0174150

Please sign in to comment.