sendgrid-ruby 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/lib/sendgrid-ruby.rb +3 -34
- data/lib/sendgrid/client.rb +33 -0
- data/lib/{helpers → sendgrid/helpers}/mail/README.md +0 -0
- data/lib/{helpers → sendgrid/helpers}/mail/mail.rb +0 -0
- data/lib/sendgrid/version.rb +3 -0
- data/sendgrid-ruby.gemspec +3 -2
- data/test/{helpers → sendgrid/helpers}/mail/test_mail.rb +2 -2
- data/test/{test_sendgrid-ruby.rb → sendgrid/test_sendgrid-ruby.rb} +1 -2
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf1a1f3164a5f6b1b0009b4c99cfb86e2fe57d5c
|
4
|
+
data.tar.gz: 980956fc2fefd6458d025fb8bcd9032ff2556195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 024e2ec69046cf1e75509bca8298c83952f6445cd1aca58d174fae8b74e29c9d867b4a6502224654e845d5339dead0fcc12791839fec266c7651c386cfe55fc8
|
7
|
+
data.tar.gz: 4fe14bcdf32b5b96d1663ac88028fc636a159e9799f539eb0d81f9448eabe2dc810712a9a31ab0c5942acd5208cac33283d1795b5c7d5e88789b8eee6e9185f3
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/sendgrid-ruby.rb
CHANGED
@@ -1,34 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require_relative 'helpers/mail'
|
4
|
-
|
5
|
-
module SendGrid
|
6
|
-
# Initialize the HTTP client
|
7
|
-
class API
|
8
|
-
attr_accessor :client
|
9
|
-
attr_reader :VERSION, :request_headers, :host, :version
|
10
|
-
# * *Args* :
|
11
|
-
# - +api_key+ -> your SendGrid API key
|
12
|
-
# - +host+ -> the base URL for the API
|
13
|
-
# - +request_headers+ -> any headers that you want to be globally applied
|
14
|
-
# - +version+ -> the version of the API you wish to access,
|
15
|
-
# currently only "v3" is supported
|
16
|
-
#
|
17
|
-
def initialize(api_key: nil, host: nil, request_headers: nil, version: nil)
|
18
|
-
@VERSION = '3.0.2'
|
19
|
-
@api_key = api_key
|
20
|
-
@host = host ? host : 'https://api.sendgrid.com'
|
21
|
-
@version = version ? version : 'v3'
|
22
|
-
@user_agent = "sendgrid/#{@VERSION};ruby"
|
23
|
-
@request_headers = JSON.parse('
|
24
|
-
{
|
25
|
-
"Authorization": "Bearer ' + @api_key + '"
|
26
|
-
}
|
27
|
-
')
|
28
|
-
|
29
|
-
@request_headers = @request_headers.merge(request_headers) if request_headers
|
30
|
-
@client = Client.new(host: "#{@host}/#{@version}",
|
31
|
-
request_headers: @request_headers)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
require_relative 'sendgrid/client'
|
2
|
+
require_relative 'sendgrid/version'
|
3
|
+
require_relative 'sendgrid/helpers/mail/mail'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Quickly and easily access the SendGrid API.
|
2
|
+
require 'ruby_http_client'
|
3
|
+
require_relative 'version'
|
4
|
+
|
5
|
+
module SendGrid
|
6
|
+
# Initialize the HTTP client
|
7
|
+
class API
|
8
|
+
attr_accessor :client
|
9
|
+
attr_reader :request_headers, :host, :version
|
10
|
+
# * *Args* :
|
11
|
+
# - +api_key+ -> your SendGrid API key
|
12
|
+
# - +host+ -> the base URL for the API
|
13
|
+
# - +request_headers+ -> any headers that you want to be globally applied
|
14
|
+
# - +version+ -> the version of the API you wish to access,
|
15
|
+
# currently only "v3" is supported
|
16
|
+
#
|
17
|
+
def initialize(api_key: nil, host: nil, request_headers: nil, version: nil)
|
18
|
+
@api_key = api_key
|
19
|
+
@host = host ? host : 'https://api.sendgrid.com'
|
20
|
+
@version = version ? version : 'v3'
|
21
|
+
@user_agent = "sendgrid/#{SendGrid::VERSION};ruby"
|
22
|
+
@request_headers = JSON.parse('
|
23
|
+
{
|
24
|
+
"Authorization": "Bearer ' + @api_key + '"
|
25
|
+
}
|
26
|
+
')
|
27
|
+
|
28
|
+
@request_headers = @request_headers.merge(request_headers) if request_headers
|
29
|
+
@client = Client.new(host: "#{@host}/#{@version}",
|
30
|
+
request_headers: @request_headers)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
File without changes
|
File without changes
|
data/sendgrid-ruby.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sendgrid/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.name = 'sendgrid-ruby'
|
7
|
-
spec.version =
|
8
|
+
spec.version = SendGrid::VERSION
|
8
9
|
spec.authors = ['Elmer Thomas', 'Robin Johnson', 'Eddie Zaneski']
|
9
10
|
spec.email = 'dx@sendgrid.com'
|
10
11
|
spec.summary = 'Official SendGrid Gem'
|
@@ -15,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
15
16
|
spec.files = `git ls-files -z`.split("\x0")
|
16
17
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
17
18
|
spec.test_files = spec.files.grep(/^(test|spec|features)/)
|
18
|
-
spec.require_paths = ['lib'
|
19
|
+
spec.require_paths = ['lib']
|
19
20
|
|
20
21
|
spec.add_dependency 'ruby_http_client', '~> 2.1.2'
|
21
22
|
spec.add_development_dependency 'rake', '~> 0'
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require_relative "
|
2
|
-
require_relative "
|
1
|
+
require_relative "../../../../lib/sendgrid/helpers/mail/mail"
|
2
|
+
require_relative "../../../../lib/sendgrid/client"
|
3
3
|
include SendGrid
|
4
4
|
require "json"
|
5
5
|
require 'minitest/autorun'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "../../lib/sendgrid/client"
|
2
2
|
require 'ruby_http_client'
|
3
3
|
require 'minitest/autorun'
|
4
4
|
|
@@ -29,7 +29,6 @@ class TestAPI < Minitest::Test
|
|
29
29
|
')
|
30
30
|
assert_equal(test_headers, sg.request_headers)
|
31
31
|
assert_equal("v3", sg.version)
|
32
|
-
assert_equal("2.0.0", sg.VERSION)
|
33
32
|
assert_instance_of(SendGrid::Client, sg.client)
|
34
33
|
end
|
35
34
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendgrid-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elmer Thomas
|
@@ -80,12 +80,14 @@ files:
|
|
80
80
|
- examples/trackingsettings/trackingsettings.rb
|
81
81
|
- examples/user/user.rb
|
82
82
|
- examples/whitelabel/whitelabel.rb
|
83
|
-
- lib/helpers/mail/README.md
|
84
|
-
- lib/helpers/mail/mail.rb
|
85
83
|
- lib/sendgrid-ruby.rb
|
84
|
+
- lib/sendgrid/client.rb
|
85
|
+
- lib/sendgrid/helpers/mail/README.md
|
86
|
+
- lib/sendgrid/helpers/mail/mail.rb
|
87
|
+
- lib/sendgrid/version.rb
|
86
88
|
- sendgrid-ruby.gemspec
|
87
|
-
- test/helpers/mail/test_mail.rb
|
88
|
-
- test/test_sendgrid-ruby.rb
|
89
|
+
- test/sendgrid/helpers/mail/test_mail.rb
|
90
|
+
- test/sendgrid/test_sendgrid-ruby.rb
|
89
91
|
homepage: http://github.com/sendgrid/sendgrid-ruby
|
90
92
|
licenses:
|
91
93
|
- MIT
|
@@ -94,7 +96,6 @@ post_install_message:
|
|
94
96
|
rdoc_options: []
|
95
97
|
require_paths:
|
96
98
|
- lib
|
97
|
-
- lib/helpers/mail
|
98
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
100
|
requirements:
|
100
101
|
- - ">="
|
@@ -112,5 +113,5 @@ signing_key:
|
|
112
113
|
specification_version: 4
|
113
114
|
summary: Official SendGrid Gem
|
114
115
|
test_files:
|
115
|
-
- test/helpers/mail/test_mail.rb
|
116
|
-
- test/test_sendgrid-ruby.rb
|
116
|
+
- test/sendgrid/helpers/mail/test_mail.rb
|
117
|
+
- test/sendgrid/test_sendgrid-ruby.rb
|