sendinblue 2.3 → 2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71cabb6ca61ca45379f1f0f5959fc73a7a83bde6
4
- data.tar.gz: 2d7e8dc636888e83ea4f47415befcc5dc1a1274a
3
+ metadata.gz: 6b5f81898e41984de0feba3c80e785b38bbf199b
4
+ data.tar.gz: 27895dcac807d3f56287d5f4c71a6812f0cdc15e
5
5
  SHA512:
6
- metadata.gz: 76dc14b6812aaa1f55a2487a31c3337ae911e8b1c76834ce80f6bca22fa59092d5f0d9c777dc3ea6d164ad9ab712e60cd2a7924b216e9e5a33614e053741a301
7
- data.tar.gz: 7a8167be67d1247709dd7a64d848c7419436548a4aacffbb30d84c3f537c4c4d34f9981b635677a3fa17daab5eb1e246f4beb1a1fbbddcd693ad2631a4d95388
6
+ metadata.gz: 30c1bad71742c875f375b1c755493f866c62a47078df788ff0395a0b5cda8eaa105cbb552f31453904940bd68b379f0827dfc0bce30a095fc0ea68f09f28f6b8
7
+ data.tar.gz: 8ffacf3076f3af856b902e5707f7f67c651a103270c58ab5fdcba62af5950b9667708b57a46205c59e6ddc5204030b113527b5e348d0370fdfe3cc2788b44ded
data/README.md CHANGED
@@ -31,9 +31,11 @@ Or install it yourself as:
31
31
  Interacting with the API.
32
32
  Below sample is used to send mail from your application using SendinBlue API.
33
33
 
34
+ Our library supports a timeout value, default is 30 Secs, which you can pass as 3rd parameter in Mailin class Object.
35
+
34
36
  ```ruby
35
37
  require 'sendinblue'
36
- m = Sendinblue::Mailin.new("https://api.sendinblue.com/v2.0","your access key")
38
+ m = Sendinblue::Mailin.new("https://api.sendinblue.com/v2.0","your access key",5) #Optional parameter: Timeout in Secs
37
39
  data = { "to" => {"to@example.net"=>"to whom!"},
38
40
  "cc" => {"cc@example.net"=>"cc whom!"},
39
41
  "bcc" => {"bcc@example.net"=>"bcc whom!"},
@@ -61,9 +63,9 @@ puts result
61
63
 
62
64
  ##Recommendation:
63
65
 
64
- Sendinblue Ruby GEM has been upgraded to new version 2.3 with object-based wrapper & have new way of sending input parameters.
66
+ Sendinblue Ruby GEM has been upgraded to new version 2.4 with object-based wrapper & have new way of sending input parameters.
65
67
 
66
- If earlier you were using version 2.0, & now upgraded to version 2.3, then you may face error in APIs like, example for send_email() api
68
+ If earlier you were using version 2.0, & now upgraded to version 2.4, then you may face error in APIs like, example for send_email() api
67
69
 
68
70
  ```ruby
69
71
  /var/lib/gems/2.x.x/gems/sendinblue-2.0/lib/sendinblue.rb:360:in `send_email': wrong number of arguments (10 for 1) (ArgumentError)
@@ -6,22 +6,27 @@ module Sendinblue
6
6
  class Mailin
7
7
  @base_url = ""
8
8
  @api_key = "Your access key"
9
- def initialize(base_url,api_key)
9
+ def initialize(base_url,api_key,timeout=nil)
10
10
  @base_url = base_url
11
11
  @api_key = api_key
12
+ @timeout = timeout
12
13
  end
13
14
  def do_request(resource,method,input)
14
15
  called_url = @base_url + "/" + resource
15
16
  content_type = "application/json"
17
+ if @timeout != nil then @timeout = @timeout else @timeout = 30 end #default timeout: 30 secs
18
+ if(@timeout != nil && (@timeout <= 0 or @timeout > 60))
19
+ raise Exception.new("value not allowed for timeout")
20
+ end
16
21
  case method
17
22
  when "GET"
18
- response = HTTParty.get(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
23
+ response = HTTParty.get(called_url,:body=>input, :default_timeout=> @timeout, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
19
24
  when "POST"
20
- response = HTTParty.post(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
25
+ response = HTTParty.post(called_url,:body=>input, :default_timeout=> @timeout, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
21
26
  when "PUT"
22
- response = HTTParty.put(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
27
+ response = HTTParty.put(called_url,:body=>input, :default_timeout=> @timeout, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
23
28
  else
24
- response = HTTParty.delete(called_url,:body=>input, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
29
+ response = HTTParty.delete(called_url,:body=>input, :default_timeout=> @timeout, :headers => {"api-key"=>@api_key,"content-type"=>content_type})
25
30
  end
26
31
  return JSON.parse(response.body)
27
32
  end
@@ -1,3 +1,3 @@
1
1
  module Sendinblue
2
- VERSION = "2.3"
2
+ VERSION = "2.4"
3
3
  end
@@ -6,7 +6,7 @@ require 'sendinblue/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "sendinblue"
8
8
  spec.version = Sendinblue::VERSION
9
- spec.date = "2016-01-22"
9
+ spec.date = "2016-05-12"
10
10
  spec.authors = ["SendinBlue Developers"]
11
11
  spec.email = ["contact@sendinblue.com"]
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendinblue
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.3'
4
+ version: '2.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - SendinBlue Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json