sparkpost 0.1.0
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 +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE +13 -0
- data/README.md +41 -0
- data/Rakefile +7 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/examples/transmission.rb +8 -0
- data/lib/core_extensions/object.rb +9 -0
- data/lib/sparkpost/client.rb +23 -0
- data/lib/sparkpost/exceptions.rb +4 -0
- data/lib/sparkpost/request.rb +37 -0
- data/lib/sparkpost/transmission.rb +60 -0
- data/lib/sparkpost/version.rb +3 -0
- data/lib/sparkpost.rb +3 -0
- data/sparkpost.gemspec +28 -0
- data/spec/lib/sparkpost/client_spec.rb +39 -0
- data/spec/lib/sparkpost/core_extensions/object_spec.rb +22 -0
- data/spec/lib/sparkpost/request_spec.rb +26 -0
- data/spec/lib/sparkpost/transmission_spec.rb +67 -0
- data/spec/lib/sparkpost/version_spec.rb +7 -0
- data/spec/spec_helper.rb +92 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aba79508e67d5e043c73f008b897d1bfd5bd5c57
|
4
|
+
data.tar.gz: d648c17cb1d275e4be2afa8efcae3cada69ee3fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4929f208113de032bfb504add476f3c6803f9fda89d3c5b88f693ad9b0496efa44321020ff129aa3fb11ff87e938540340d69a9b09208b42d63bdbb8641e7ca2
|
7
|
+
data.tar.gz: 7aff3ffc3949ab6480a5d9ffd712611e73f59f23074f7cda005d303c07c7a2bf5e68c69553d6e9d6fa00002838ee1a33db4e2a28fbd163d015f5f379f251e56a
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2015 Message Systems, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
4
|
+
You may not use this software except in compliance with the License.
|
5
|
+
|
6
|
+
A copy of the License is located at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0.html
|
9
|
+
|
10
|
+
or in the "license" file accompanying this software. This file is
|
11
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12
|
+
ANY KIND, either express or implied. See the License for the specific
|
13
|
+
language governing permissions and limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
<a href="https://www.sparkpost.com"><img src="https://www.sparkpost.com/sites/default/files/attachments/SparkPost_Logo_2-Color_Gray-Orange_RGB.svg" width="200px"/></a>
|
2
|
+
|
3
|
+
[Sign up](https://app.sparkpost.com/sign-up?src=Dev-Website&sfdcid=70160000000pqBb) for a SparkPost account and visit our [Developer Hub](https://developers.sparkpost.com) for even more content.
|
4
|
+
|
5
|
+
# SparkPost Ruby API Client
|
6
|
+
|
7
|
+
[](https://travis-ci.org/SparkPost/ruby-sparkpost) [](https://coveralls.io/github/SparkPost/ruby-sparkpost?branch=master)
|
8
|
+
|
9
|
+
The official Ruby client library for Sparkpost
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'sparkpost'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install sparkpost
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
TODO: Write usage instructions here
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( http://github.com/<my-github-username>ruby-sparkpost/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sparkpost"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module SparkPost
|
2
|
+
class Client
|
3
|
+
attr_reader :transmission
|
4
|
+
|
5
|
+
def initialize(api_key = nil, api_host = 'https://api.sparkpost.com')
|
6
|
+
@api_key = (api_key || ENV['SPARKPOST_API_KEY']).to_s
|
7
|
+
@api_host = (api_host || ENV['SPARKPOST_API_HOST']).to_s
|
8
|
+
|
9
|
+
if @api_key.blank?
|
10
|
+
fail ArgumentError, 'No API key is provided. Either provide api_key with constructor or set SPARKPOST_API_KEY environment variable'
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
if @api_host.blank?
|
15
|
+
fail ArgumentError, 'No API host is provided. Either provide api_host with constructor or set SPARKPOST_API_HOST environment variable'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def transmission
|
20
|
+
@transmission ||= Transmission.new(@api_key, @api_host)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require_relative 'version'
|
5
|
+
require_relative 'exceptions'
|
6
|
+
|
7
|
+
module SparkPost
|
8
|
+
module Request
|
9
|
+
|
10
|
+
def request(url, api_key, data)
|
11
|
+
uri = URI.parse(url)
|
12
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
13
|
+
http.use_ssl = true
|
14
|
+
http.set_debug_output($stdout)
|
15
|
+
headers = {
|
16
|
+
'User-Agent' => 'ruby-sparkpost/' + VERSION,
|
17
|
+
'Content-Type' => 'application/json',
|
18
|
+
'Authorization' => api_key
|
19
|
+
}
|
20
|
+
req = Net::HTTP::Post.new(uri.path, initheader=headers)
|
21
|
+
req.body = data.to_json
|
22
|
+
|
23
|
+
process_response(http.request(req));
|
24
|
+
end
|
25
|
+
|
26
|
+
def process_response(response)
|
27
|
+
response = JSON.parse(response.body)
|
28
|
+
if response['errors']
|
29
|
+
fail SparkPost::DeliveryException, response['errors']
|
30
|
+
else
|
31
|
+
response['results']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module_function :request, :process_response
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'http'
|
4
|
+
require_relative '../core_extensions/object'
|
5
|
+
require_relative 'request'
|
6
|
+
require_relative 'exceptions'
|
7
|
+
|
8
|
+
module SparkPost
|
9
|
+
class Transmission
|
10
|
+
include Request
|
11
|
+
|
12
|
+
def initialize(api_key, api_host)
|
13
|
+
@api_key = api_key
|
14
|
+
@api_host = api_host
|
15
|
+
end
|
16
|
+
|
17
|
+
def endpoint
|
18
|
+
@api_host.concat('/api/v1/transmissions')
|
19
|
+
end
|
20
|
+
|
21
|
+
def send_message(to, from, subject, html_message = nil, **options)
|
22
|
+
#todo add validations for to, from
|
23
|
+
unless to.is_a?(Array)
|
24
|
+
to = [to]
|
25
|
+
end
|
26
|
+
|
27
|
+
if html_message.blank? && options[:text_message].blank?
|
28
|
+
fail ArgumentError, 'Content missing. Either provide html_message or text_message in options parameter'
|
29
|
+
end
|
30
|
+
|
31
|
+
options.merge!(
|
32
|
+
{
|
33
|
+
recipients: prepare_recipients(to),
|
34
|
+
content: {
|
35
|
+
from: from,
|
36
|
+
subject: subject,
|
37
|
+
text: options['text_message'],
|
38
|
+
html: html_message
|
39
|
+
},
|
40
|
+
options: {}
|
41
|
+
}
|
42
|
+
)
|
43
|
+
|
44
|
+
request(endpoint, @api_key, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def prepare_recipients(recipients)
|
49
|
+
recipients.map do |recipient|
|
50
|
+
{
|
51
|
+
address: {
|
52
|
+
email: recipient
|
53
|
+
}
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/lib/sparkpost.rb
ADDED
data/sparkpost.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require './lib/sparkpost/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sparkpost"
|
8
|
+
spec.version = SparkPost::VERSION
|
9
|
+
spec.authors = ["SparkPost", "Aimee Knight", "Mohammad Hossain"]
|
10
|
+
spec.email = "developers@sparkpost.com"
|
11
|
+
spec.summary = "SparkPost Ruby API client"
|
12
|
+
spec.homepage = "https://developers.sparkpost.com"
|
13
|
+
spec.license = "Apache-2.0"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency 'http', '0.9.8'
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.3.0"
|
25
|
+
spec.add_development_dependency "simplecov", "~> 0.11.1"
|
26
|
+
spec.add_development_dependency "webmock", "~> 1.22.3"
|
27
|
+
spec.add_development_dependency "coveralls"
|
28
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SparkPost::Transmission do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'when api key and host are passed'
|
6
|
+
let(:client) { SparkPost::Client.new('123', 'http://sparkpost.com') }
|
7
|
+
|
8
|
+
it { expect(client.instance_variables).to include(:@api_key) }
|
9
|
+
it { expect(client.instance_variables).to include(:@api_host) }
|
10
|
+
it { expect(client.instance_variable_get(:@api_key)).to eq('123') }
|
11
|
+
it { expect(client.instance_variable_get(:@api_host)).to eq('http://sparkpost.com') }
|
12
|
+
|
13
|
+
context 'when api key not passed' do
|
14
|
+
before do
|
15
|
+
ENV['SPARKPOST_API_KEY'] = nil
|
16
|
+
end
|
17
|
+
it { expect {SparkPost::Client.new }.to raise_error(ArgumentError) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when api host not passed' do
|
21
|
+
before do
|
22
|
+
ENV['SPARKPOST_API_HOST'] = nil
|
23
|
+
end
|
24
|
+
it { expect(SparkPost::Client.new('abc').instance_variable_get(:@api_host)).to eq('https://api.sparkpost.com') }
|
25
|
+
it { expect { SparkPost::Client.new('abc', nil) }.to raise_error(ArgumentError) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#transmission' do
|
30
|
+
let(:client) { SparkPost::Client.new('123', 'http://sparkpost.com') }
|
31
|
+
|
32
|
+
it { expect(client.transmission).to be_kind_of(SparkPost::Transmission) }
|
33
|
+
|
34
|
+
it 'returns same instances on subsequent call' do
|
35
|
+
expect(client.transmission).to eq(client.transmission)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe 'Object' do
|
5
|
+
describe '#blank?' do
|
6
|
+
it { expect(''.blank?).to be(true)}
|
7
|
+
it { expect(nil.blank?).to be(true)}
|
8
|
+
it { expect(true.blank?).to be(false)}
|
9
|
+
it { expect(Hash.new.blank?).to be(true)}
|
10
|
+
it { expect({}.blank?).to be(true)}
|
11
|
+
it { expect([].blank?).to be(true)}
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#present?' do
|
15
|
+
it { expect(''.present?).to be(false)}
|
16
|
+
it { expect(nil.present?).to be(false)}
|
17
|
+
it { expect(true.present?).to be(true)}
|
18
|
+
it { expect(Hash.new.present?).to be(false)}
|
19
|
+
it { expect({}.present?).to be(false)}
|
20
|
+
it { expect([].present?).to be(false)}
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SparkPost::Request do
|
4
|
+
describe '#request' do
|
5
|
+
api_url = 'https://api.sparkpost.com/api/'
|
6
|
+
|
7
|
+
let(:api_key) { '123' }
|
8
|
+
let(:request) { SparkPost::Request.request }
|
9
|
+
|
10
|
+
context 'when was successful' do
|
11
|
+
response = {results: {"total_rejected_recipients"=>0, "total_accepted_recipients"=>1, "id"=>"102238681582044821"} }
|
12
|
+
before do
|
13
|
+
stub_request(:post, api_url).to_return(body: response.to_json, status: 200)
|
14
|
+
end
|
15
|
+
it { expect(SparkPost::Request.request(api_url, '123', {})).to eq(response[:results]) }
|
16
|
+
end
|
17
|
+
context 'when was not successful' do
|
18
|
+
response = {errors: {message: 'end of world'} }
|
19
|
+
before do
|
20
|
+
stub_request(:post, api_url).to_return(body: response.to_json, status: 500)
|
21
|
+
end
|
22
|
+
|
23
|
+
it { expect { SparkPost::Request.request(api_url, '123', {})}.to raise_error(SparkPost::DeliveryException).with_message(/end of world/) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SparkPost::Transmission do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'when api key and host are passed'
|
6
|
+
let(:transmission) { SparkPost::Transmission.new('123', 'http://sparkpost.com') }
|
7
|
+
|
8
|
+
it { expect(transmission.instance_variables).to include(:@api_key) }
|
9
|
+
it { expect(transmission.instance_variables).to include(:@api_host) }
|
10
|
+
it { expect(transmission.instance_variable_get(:@api_key)).to eq('123') }
|
11
|
+
it { expect(transmission.instance_variable_get(:@api_host)).to eq('http://sparkpost.com') }
|
12
|
+
|
13
|
+
context 'when api key or host not passed' do
|
14
|
+
it {expect {SparkPost::Transmission.new }.to raise_error(ArgumentError) }
|
15
|
+
it {expect {SparkPost::Transmission.new(123) }.to raise_error(ArgumentError) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#send_message' do
|
20
|
+
let(:transmission) { SparkPost::Transmission.new('123456', 'https://api.sparkpost.com')}
|
21
|
+
let(:url) { 'https://api.sparkpost.com/api/v1/transmissions' }
|
22
|
+
before do
|
23
|
+
allow(transmission).to receive(:request).and_return({})
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'requests correct endpoint' do
|
27
|
+
allow(transmission).to receive(:request) do |_url|
|
28
|
+
expect(_url).to eq(url)
|
29
|
+
end
|
30
|
+
|
31
|
+
transmission.send_message('to@example.com', 'from@example.com', 'test subject', '<h1>Hello World</h1>')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'requests with correct parameters' do
|
35
|
+
allow(transmission).to receive(:request) do |_url, api_key, data|
|
36
|
+
expect(data[:recipients].length).to eq(1)
|
37
|
+
expect(data[:recipients][0][:address]).to eq({email: 'to@example.com'})
|
38
|
+
expect(data[:content][:from]).to eq('from@example.com')
|
39
|
+
expect(data[:content][:subject]).to eq('test subject')
|
40
|
+
expect(data[:content][:html]).to eq('<h1>Hello World</h1>')
|
41
|
+
end
|
42
|
+
transmission.send_message('to@example.com', 'from@example.com', 'test subject', '<h1>Hello World</h1>')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'handles array of recipients correctly' do
|
46
|
+
allow(transmission).to receive(:request) do |_url, api_key, data|
|
47
|
+
expect(data[:recipients].length).to eq(1)
|
48
|
+
expect(data[:recipients][0][:address]).to eq({email: 'to@example.com'})
|
49
|
+
end
|
50
|
+
transmission.send_message(['to@example.com'], 'from@example.com', 'test subject', '<h1>Hello World</h1>')
|
51
|
+
end
|
52
|
+
|
53
|
+
it { expect {transmission.send_message(['to@example.com'], 'from@example.com', 'test subject')}.to raise_error(ArgumentError).with_message(/Content missing/) }
|
54
|
+
it { expect {transmission.send_message(['to@example.com'], 'from@example.com', 'test subject', nil, {text_message: 'hello world'})}.to_not raise_error }
|
55
|
+
|
56
|
+
it 'passes through delivery exception' do
|
57
|
+
allow(transmission).to receive(:request).and_raise(SparkPost::DeliveryException.new('Some delivery error'))
|
58
|
+
|
59
|
+
expect { transmission.send_message('to@example.com', 'from@example.com', 'test subject', '<h1>Hello World</h1>')}.to raise_error(SparkPost::DeliveryException).with_message(/Some delivery error/)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'passes responses' do
|
63
|
+
allow(transmission).to receive(:request).and_return({success: 1})
|
64
|
+
expect(transmission.send_message('to@example.com', 'from@example.com', 'test subject', '<h1>Hello World</h1>')).to eq({success: 1})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
2
|
+
require 'simplecov'
|
3
|
+
require 'coveralls'
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
SimpleCov.start
|
9
|
+
|
10
|
+
require 'webmock/rspec'
|
11
|
+
require_relative '../lib/sparkpost'
|
12
|
+
WebMock.disable_net_connect!
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
# rspec-expectations config goes here. You can use an alternate
|
16
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
17
|
+
# assertions if you prefer.
|
18
|
+
config.expect_with :rspec do |expectations|
|
19
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
20
|
+
# and `failure_message` of custom matchers include text for helper methods
|
21
|
+
# defined using `chain`, e.g.:
|
22
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
23
|
+
# # => "be bigger than 2 and smaller than 4"
|
24
|
+
# ...rather than:
|
25
|
+
# # => "be bigger than 2"
|
26
|
+
expectations.syntax = :expect
|
27
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
28
|
+
end
|
29
|
+
|
30
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
31
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
32
|
+
config.mock_with :rspec do |mocks|
|
33
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
34
|
+
# a real object. This is generally recommended, and will default to
|
35
|
+
# `true` in RSpec 4.
|
36
|
+
mocks.verify_partial_doubles = true
|
37
|
+
end
|
38
|
+
|
39
|
+
# The settings below are suggested to provide a good initial experience
|
40
|
+
# with RSpec, but feel free to customize to your heart's content.
|
41
|
+
=begin
|
42
|
+
# These two settings work together to allow you to limit a spec run
|
43
|
+
# to individual examples or groups you care about by tagging them with
|
44
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
45
|
+
# get run.
|
46
|
+
config.filter_run :focus
|
47
|
+
config.run_all_when_everything_filtered = true
|
48
|
+
|
49
|
+
# Allows RSpec to persist some state between runs in order to support
|
50
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
51
|
+
# you configure your source control system to ignore this file.
|
52
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
53
|
+
|
54
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
55
|
+
# recommended. For more details, see:
|
56
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
57
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
58
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
59
|
+
config.disable_monkey_patching!
|
60
|
+
|
61
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
62
|
+
# be too noisy due to issues in dependencies.
|
63
|
+
config.warnings = true
|
64
|
+
|
65
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
66
|
+
# file, and it's useful to allow more verbose output when running an
|
67
|
+
# individual spec file.
|
68
|
+
if config.files_to_run.one?
|
69
|
+
# Use the documentation formatter for detailed output,
|
70
|
+
# unless a formatter has already been configured
|
71
|
+
# (e.g. via a command-line flag).
|
72
|
+
config.default_formatter = 'doc'
|
73
|
+
end
|
74
|
+
|
75
|
+
# Print the 10 slowest examples and example groups at the
|
76
|
+
# end of the spec run, to help surface which specs are running
|
77
|
+
# particularly slow.
|
78
|
+
config.profile_examples = 10
|
79
|
+
|
80
|
+
# Run specs in random order to surface order dependencies. If you find an
|
81
|
+
# order dependency and want to debug it, you can fix the order by providing
|
82
|
+
# the seed, which is printed after each run.
|
83
|
+
# --seed 1234
|
84
|
+
config.order = :random
|
85
|
+
|
86
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
87
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
88
|
+
# test failures related to randomization by passing the same `--seed` value
|
89
|
+
# as the one that triggered the failure.
|
90
|
+
Kernel.srand config.seed
|
91
|
+
=end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sparkpost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SparkPost
|
8
|
+
- Aimee Knight
|
9
|
+
- Mohammad Hossain
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: http
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.8
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.9.8
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: bundler
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '1.5'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.5'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rake
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.3.0
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.3.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: simplecov
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.11.1
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 0.11.1
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: webmock
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 1.22.3
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.22.3
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: coveralls
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
description:
|
114
|
+
email: developers@sparkpost.com
|
115
|
+
executables:
|
116
|
+
- console
|
117
|
+
- setup
|
118
|
+
extensions: []
|
119
|
+
extra_rdoc_files: []
|
120
|
+
files:
|
121
|
+
- ".coveralls.yml"
|
122
|
+
- ".gitignore"
|
123
|
+
- ".rspec"
|
124
|
+
- ".travis.yml"
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- examples/transmission.rb
|
132
|
+
- lib/core_extensions/object.rb
|
133
|
+
- lib/sparkpost.rb
|
134
|
+
- lib/sparkpost/client.rb
|
135
|
+
- lib/sparkpost/exceptions.rb
|
136
|
+
- lib/sparkpost/request.rb
|
137
|
+
- lib/sparkpost/transmission.rb
|
138
|
+
- lib/sparkpost/version.rb
|
139
|
+
- sparkpost.gemspec
|
140
|
+
- spec/lib/sparkpost/client_spec.rb
|
141
|
+
- spec/lib/sparkpost/core_extensions/object_spec.rb
|
142
|
+
- spec/lib/sparkpost/request_spec.rb
|
143
|
+
- spec/lib/sparkpost/transmission_spec.rb
|
144
|
+
- spec/lib/sparkpost/version_spec.rb
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
homepage: https://developers.sparkpost.com
|
147
|
+
licenses:
|
148
|
+
- Apache-2.0
|
149
|
+
metadata: {}
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.4.5.1
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: SparkPost Ruby API client
|
170
|
+
test_files:
|
171
|
+
- spec/lib/sparkpost/client_spec.rb
|
172
|
+
- spec/lib/sparkpost/core_extensions/object_spec.rb
|
173
|
+
- spec/lib/sparkpost/request_spec.rb
|
174
|
+
- spec/lib/sparkpost/transmission_spec.rb
|
175
|
+
- spec/lib/sparkpost/version_spec.rb
|
176
|
+
- spec/spec_helper.rb
|