sendgrid-ruby 4.0.4 → 4.0.5

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: 3b55be9596fe7e0909a03c49cb9e698d922a1a39
4
- data.tar.gz: 06a368c6b3602362d1efd92570797f284c24fd7a
3
+ metadata.gz: 45c988f70cffd958c9fd2584996418bb298a26af
4
+ data.tar.gz: e7b1f78db42b513d14d250427fa93751d2042670
5
5
  SHA512:
6
- metadata.gz: a03a6e57f9ba993d5ca038bb5a270821dde415188f4b0c38bb7454cda68c7b1136b49b8dec624eda22d389e12c2fa9ed7669b40f4c743022d6a6d34927f59702
7
- data.tar.gz: ae5d547a542b5ca06b0086407f50ab67cd0b103a956ad77a4d4e9efb0a3e6344651420025db6bd2e8fcb53d293cbecb733d299b1ac201b657ad41e4356806a7e
6
+ metadata.gz: 9d3620dea68b81957963929757b6d40499956b522f5107c074ea61015977a6a16443411142356a0b95b96b3f2314f1dbb035054a77680eda18e75b088709c340
7
+ data.tar.gz: e4effa159c2dfe07b658c41c7586491ae562894c20fb46b35d7fd45905b51de8a122d2bf4685a41a82e1530b07d1327084b501701235b7f42cac6f77748446db
@@ -1,6 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2
4
+ before_script:
5
+ - mkdir prism
6
+ - mkdir prism/bin
7
+ - export PATH=$PATH:$PWD/prism/bin/
8
+ - ./test/prism.sh
4
9
  notifications:
5
10
  hipchat:
6
11
  rooms:
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [4.0.5] - 2016-10-17 ##
5
+ ### Added
6
+ - Pull #110, fixed Issue #109
7
+ - Automates StopLight.io Prism mock server locally & on Travis CI
8
+ - Thanks to [KY](https://github.com/tkbky) for the pull request!
9
+
4
10
  ## [4.0.4] - 2016-09-15 ##
5
11
  ### Fixed
6
12
  - Pull #72: [remove unnecessary ruby 2.2 requirement](https://github.com/sendgrid/sendgrid-ruby/pull/72)
@@ -83,19 +83,6 @@ We welcome direct contributions to the sendgrid-ruby code base. Thank you!
83
83
  bundle install
84
84
  ```
85
85
 
86
- 1. Download [prism](https://stoplight.io/prism/) for your platform ([Mac OS X](https://github.com/stoplightio/prism/releases/download/v0.1.5/prism_darwin_amd64)) and save the binary to the sendgrid-ruby directory (or any directory you would like. The sendgrid-ruby directory is chosen mostly for convenience.)
87
- 1. Add execute permissions
88
-
89
- ```bash
90
- chmod +x prism
91
- ```
92
- 1. Download the [prism spec for sendgrid](https://api.stoplight.io/v1/versions/563a5309daad691100fb05af/export/stoplight.json) and save it to the same directory
93
- 1. In a separate terminal, cd into the directory you chose for prism and start the sendgrid local server which the tests will use.
94
-
95
- ```bash
96
- ./prism run --mock --list --spec stoplight.json
97
- ```
98
-
99
86
  ## Environment Variables
100
87
 
101
88
  First, get your free SendGrid account [here](https://sendgrid.com/free?source=sendgrid-ruby).
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '4.0.4'
2
+ VERSION = '4.0.5'
3
3
  end
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+
3
+ install () {
4
+
5
+ set -eu
6
+
7
+ UNAME=$(uname)
8
+ ARCH=$(uname -m)
9
+ if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
10
+ echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
11
+ exit 1
12
+ fi
13
+
14
+ if [ "$UNAME" = "Darwin" ] ; then
15
+ OSX_ARCH=$(uname -m)
16
+ if [ "${OSX_ARCH}" = "x86_64" ] ; then
17
+ PLATFORM="darwin_amd64"
18
+ fi
19
+ elif [ "$UNAME" = "Linux" ] ; then
20
+ LINUX_ARCH=$(uname -m)
21
+ if [ "${LINUX_ARCH}" = "i686" ] ; then
22
+ PLATFORM="linux_386"
23
+ elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
24
+ PLATFORM="linux_amd64"
25
+ fi
26
+ fi
27
+
28
+ #LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2)
29
+ LATEST="v0.2.7"
30
+ URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM"
31
+ DEST=./prism/bin/prism
32
+
33
+ if [ -z $LATEST ] ; then
34
+ echo "Error requesting. Download binary from ${URL}"
35
+ exit 1
36
+ else
37
+ curl -L $URL -o $DEST
38
+ chmod +x $DEST
39
+ fi
40
+ }
41
+
42
+ install
@@ -4,6 +4,27 @@ require 'minitest/autorun'
4
4
  require 'minitest/unit'
5
5
 
6
6
  class TestAPI < MiniTest::Test
7
+
8
+ unless File.exists?('/usr/local/bin/prism') || File.exists?(File.join(Dir.pwd, 'prism/bin/prism'))
9
+ if RUBY_PLATFORM =~ /mswin|mingw/
10
+ puts 'Please download the Windows binary (https://github.com/stoplightio/prism/releases) and place it in your /usr/local/bin directory'
11
+ else
12
+ puts 'Installing Prism'
13
+ IO.popen(['curl', '-s', 'https://raw.githubusercontent.com/stoplightio/prism/master/install.sh']) do |io|
14
+ out = io.read
15
+ unless system(out)
16
+ puts "Error downloading the prism binary, you can try downloading directly here (https://github.com/stoplightio/prism/releases) and place in your /user/local/bin directory, #{out}"
17
+ exit
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ puts 'Activating Prism (~20 seconds)'
24
+ @@prism_pid = spawn('prism run --mock --list --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json', [:out, :err] => '/dev/null')
25
+ sleep(15)
26
+ puts 'Prism started'
27
+
7
28
  def setup
8
29
  if ENV['TRAVIS']
9
30
  host = ENV['MOCK_HOST']
@@ -13,6 +34,11 @@ class TestAPI < MiniTest::Test
13
34
  @sg = SendGrid::API.new(api_key: "SENDGRID_API_KEY", host: host)
14
35
  end
15
36
 
37
+ Minitest.after_run do
38
+ Process.kill('TERM', @@prism_pid)
39
+ puts 'Prism shut down'
40
+ end
41
+
16
42
  def test_init
17
43
  headers = JSON.parse('
18
44
  {
@@ -31,7 +57,7 @@ class TestAPI < MiniTest::Test
31
57
  ')
32
58
  assert_equal(test_headers, sg.request_headers)
33
59
  assert_equal("v3", sg.version)
34
- assert_equal("4.0.4", SendGrid::VERSION)
60
+ assert_equal("4.0.5", SendGrid::VERSION)
35
61
  assert_instance_of(SendGrid::Client, sg.client)
36
62
  end
37
63
 
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: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elmer Thomas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-09-15 00:00:00.000000000 Z
13
+ date: 2016-10-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_http_client
@@ -104,6 +104,7 @@ files:
104
104
  - lib/sendgrid/helpers/mail/mail.rb
105
105
  - lib/sendgrid/version.rb
106
106
  - sendgrid-ruby.gemspec
107
+ - test/prism.sh
107
108
  - test/sendgrid/helpers/mail/test_mail.rb
108
109
  - test/sendgrid/test_sendgrid-ruby.rb
109
110
  homepage: http://github.com/sendgrid/sendgrid-ruby
@@ -131,5 +132,6 @@ signing_key:
131
132
  specification_version: 4
132
133
  summary: Official SendGrid Gem
133
134
  test_files:
135
+ - test/prism.sh
134
136
  - test/sendgrid/helpers/mail/test_mail.rb
135
137
  - test/sendgrid/test_sendgrid-ruby.rb