nifty-email 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/nifty-email.rb +4 -8
- data/lib/nifty-email/version.rb +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: 6f776f87c74b4e075582be5a3c96cd468adbd66b
|
4
|
+
data.tar.gz: 8c38f6c33a2456a8c3f7c6c3b96d05f2cf6c5f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd26b890705b801a5019b078630fbaeb609f19d0315c394e959b663e1be687e7d4ed7aa9d13fb1636d30cd9a22bc2decfe2c056bc696112298dd1d3491887cc9
|
7
|
+
data.tar.gz: ca50cbb6d13cd5e4b105d8cf6cce0549e8018652c8010b6c61930d37fe31e8db999046073a116c181a0d9e9865145e1e79b4e6ecc167f0626e5d037a763cd8e1
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
|
|
21
21
|
### General example
|
22
22
|
|
23
23
|
```
|
24
|
-
NiftyEmail.
|
24
|
+
NiftyEmail.api_token = '4U2+OKuABdopirrzp/zDdA=='
|
25
25
|
|
26
26
|
email = NiftyEmail.get_email('awesome-email', full_name: 'Jim Tom')
|
27
27
|
puts email.html
|
@@ -33,7 +33,7 @@ puts email.text
|
|
33
33
|
```
|
34
34
|
# initializer
|
35
35
|
|
36
|
-
NiftyEmail.
|
36
|
+
NiftyEmail.api_token = '4U2+OKuABdopirrzp/zDdA=='
|
37
37
|
|
38
38
|
# mailer
|
39
39
|
|
data/lib/nifty-email.rb
CHANGED
@@ -3,24 +3,20 @@ require 'json'
|
|
3
3
|
class NiftyEmail
|
4
4
|
class NiftyEmailError < StandardError; end
|
5
5
|
|
6
|
-
def self.
|
7
|
-
@
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.token
|
11
|
-
@token
|
6
|
+
def self.api_token=(api_token)
|
7
|
+
@api_token = api_token
|
12
8
|
end
|
13
9
|
|
14
10
|
def self.get_email(slug_or_id, placeholders = {})
|
15
11
|
connection = Faraday.new(url: 'http://nifty-email-production.herokuapp.com/api/emails')
|
16
|
-
connection.authorization('Token', token: @
|
12
|
+
connection.authorization('Token', token: @api_token)
|
17
13
|
|
18
14
|
response = connection.get("#{slug_or_id}.json", placeholders)
|
19
15
|
|
20
16
|
if response.status == 200
|
21
17
|
NiftyEmail::Email.new(JSON.parse(response.body))
|
22
18
|
else
|
23
|
-
raise NiftyEmailError, response.body
|
19
|
+
raise NiftyEmailError, JSON.parse(response.body)['error']
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
data/lib/nifty-email/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nifty-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Albertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|