nifty-email 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39588305aa311a21238a6ec36b77c7c4adf1aa30
4
- data.tar.gz: c2e621511aa880dd8f5e19b1d41bbf6850f8e662
3
+ metadata.gz: 6f776f87c74b4e075582be5a3c96cd468adbd66b
4
+ data.tar.gz: 8c38f6c33a2456a8c3f7c6c3b96d05f2cf6c5f46
5
5
  SHA512:
6
- metadata.gz: c0bf53d147b5b08ac90b8d1fe3f0613b645612b26e740c2e011754bab95e2c2ed28da11fb72405de791d4f1d2198fb58426f9abeacedaeada70d9a943ad5eef2
7
- data.tar.gz: 0f213501dfe87ec26265b25ec5755a22082e846ddc07aa2f8de324cd4968142760394b6d68651d3e8c2865c0cd5a77bc159ed158b09dad124c0011923d8f0a6e
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.token = '123abc'
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.token = '123abc'
36
+ NiftyEmail.api_token = '4U2+OKuABdopirrzp/zDdA=='
37
37
 
38
38
  # mailer
39
39
 
@@ -3,24 +3,20 @@ require 'json'
3
3
  class NiftyEmail
4
4
  class NiftyEmailError < StandardError; end
5
5
 
6
- def self.token=(token)
7
- @token = token
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: @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
 
@@ -1,5 +1,5 @@
1
1
  module Nifty
2
2
  module Email
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
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.5
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-12 00:00:00.000000000 Z
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler