sendinblue 2.3 → 2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/sendinblue.rb +10 -5
- data/lib/sendinblue/version.rb +1 -1
- data/sendinblue.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b5f81898e41984de0feba3c80e785b38bbf199b
|
4
|
+
data.tar.gz: 27895dcac807d3f56287d5f4c71a6812f0cdc15e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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)
|
data/lib/sendinblue.rb
CHANGED
@@ -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
|
data/lib/sendinblue/version.rb
CHANGED
data/sendinblue.gemspec
CHANGED
@@ -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-
|
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.
|
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-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|