enveloop 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 94446b08f6c486bdbc018ee236d7a6df30e2fb2bbbaac772a28234378c993153
4
- data.tar.gz: d389312fe9a5adf7f2beb313501ada0fc80b42ef3b6c98e36b4b2a93c61bb28a
3
+ metadata.gz: 1af89bdd26c1380d6f05ebf9b9ab9e86c29617eeb689760c88dd81f7009397cd
4
+ data.tar.gz: 51c5c8a2ffc6e557e469b14a5dac3b1b04628c484525189598a893c55de7630f
5
5
  SHA512:
6
- metadata.gz: 20034589bd1a305bcfc42a5938ed4c9d35fc8fc246fed35e7616a30c49a3f7e1f65213aaccbd16cce5d85ce46fa02bb9ab587e34391734c0a5dc0a6d8f3aa09a
7
- data.tar.gz: 9060749ef67da1136deefcac4e95692048b98633dce81450be293338c107729af7f58c59abdb410defa6803954b50e35030ff64c9105570af63c2b8319597d9c
6
+ metadata.gz: 3048366a973c5115ac2e9c5dafae487441c62d4f43d6106dc9886f3dbca336d41870195f25d15bdb5f4fc3811bd47ad49d2fa40face26866921f01e6b0b830ca
7
+ data.tar.gz: de31f9fb4c68cab0c0773e4e1a192a1fc9ff64904254f4e5468c35addbd1f94d419f44792448bd1781831e385f17ad1c9832e6bc5ed5216b26f85c95964498a9
data/CHANGELOG.md CHANGED
@@ -3,4 +3,8 @@
3
3
  > ## Version 0.1.0
4
4
  > Initial Release.
5
5
 
6
- * Adds support for sending emails
6
+ * Adds support for sending emails
7
+
8
+ > ## Version 0.1.1
9
+
10
+ * Add Response class
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enveloop (0.1.0)
4
+ enveloop (0.1.1)
5
5
  faraday
6
6
 
7
7
  GEM
@@ -26,7 +26,7 @@ GEM
26
26
  diff-lcs (>= 1.2.0, < 2.0)
27
27
  rspec-support (~> 3.10.0)
28
28
  rspec-support (3.10.2)
29
- ruby2_keywords (0.0.2)
29
+ ruby2_keywords (0.0.4)
30
30
 
31
31
  PLATFORMS
32
32
  ruby
@@ -21,9 +21,11 @@ module Enveloop
21
21
  }
22
22
  )
23
23
 
24
- conn.post("/templates/#{template}") do |req|
24
+ response = conn.post("/templates/#{template}") do |req|
25
25
  req.body = data.to_json
26
26
  end
27
+
28
+ return Response.new(status: response.status, body: response.body)
27
29
  end
28
30
  end
29
31
  end
@@ -0,0 +1,24 @@
1
+ module Enveloop
2
+ class Response
3
+ attr_reader :status, :message, :error
4
+
5
+ def initialize(status: 200, body: nil)
6
+ @status = status
7
+
8
+ if status == 200
9
+ @message = JSON.parse(body)
10
+ @error = nil
11
+ elsif status == 500
12
+ @message = nil
13
+ @error = JSON.parse(body)['error']
14
+ else
15
+ @message = nil
16
+ @error = 'Unknown error'
17
+ end
18
+ end
19
+
20
+ def success?
21
+ @status == 200
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Enveloop
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/enveloop.rb CHANGED
@@ -1,9 +1,9 @@
1
- require "enveloop/version"
2
-
3
1
  require "faraday"
4
2
  require "json"
5
3
 
4
+ require "enveloop/version"
6
5
  require 'enveloop/client'
6
+ require 'enveloop/response'
7
7
 
8
8
  module Enveloop
9
9
  class Error < StandardError; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enveloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Wyrosdick
@@ -45,6 +45,7 @@ files:
45
45
  - enveloop.gemspec
46
46
  - lib/enveloop.rb
47
47
  - lib/enveloop/client.rb
48
+ - lib/enveloop/response.rb
48
49
  - lib/enveloop/version.rb
49
50
  homepage: https://github.com/enveloophq/ruby_enveloop
50
51
  licenses:
@@ -68,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  requirements: []
71
- rubygems_version: 3.1.2
72
+ rubygems_version: 3.1.4
72
73
  signing_key:
73
74
  specification_version: 4
74
75
  summary: Envelope API wrapper