sendable_rails 0.1.0 → 0.2.0

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: 2eccfeeb86dea973b1ddcd6273f5e685b6883976
4
- data.tar.gz: 9c361d133be2d7d9a21a502b8929b0ac48698c96
3
+ metadata.gz: f8d50a75f166eadfbd955b0036f6267889f39613
4
+ data.tar.gz: 8af4aa8d5308bf41f8e4e277e51a004a214d5ebd
5
5
  SHA512:
6
- metadata.gz: a4dd8b70afdf2cf8a89b2f81dd3ee93e4eb9755342c90c60d625dfafa50350a814d7060f0811e820fcaaa964e42be8e05c25e79b5386a51694e1cac4518c1d2b
7
- data.tar.gz: 44b41da40390a61b8ff6acf5159cfb1e8c7a175d469490a74578682b52240088519e19d3d3595034ace73983205dc81a2cc11869a56947e4b2dbadd1c48c9f2a
6
+ metadata.gz: 5ea541928c19560789624d4528a30b8018106dcd756ea5ff6e4de6a4ffb197fd7a63cf38fe9f8e5d1d98d20fe3f582d77cb8be95a73f67e72db233d44dfc6dd4
7
+ data.tar.gz: 37fe0658e9f719e594380b8ed0f5452cfbc39e3d3bc37fe2bcec9cdb26642367a5d458b5902c18f3c0fbe2e06000160e2ecd5414a6153783ed8aee0b8e6f60a0
@@ -1,5 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
+ require 'json'
3
4
 
4
5
  module SendableRails
5
6
  module ActionMailerExt
@@ -32,11 +33,19 @@ module SendableRails
32
33
  request.set_form_data(params)
33
34
  response = http.request(request)
34
35
 
35
- content = response.body
36
+ email = JSON.parse(response.body)
36
37
 
37
- [{
38
- content: content
39
- }]
38
+ formats = []
39
+
40
+ if (email['html'])
41
+ formats << { content_type: 'text/html', body: email['html'] }
42
+ end
43
+
44
+ if (email['plain'])
45
+ formats << { content_type: 'text/plain', body: email['text'] }
46
+ end
47
+
48
+ formats
40
49
  else
41
50
  super
42
51
  end
@@ -4,8 +4,13 @@ module SendableRails
4
4
 
5
5
  initializer "sendable.configure" do |app|
6
6
  SendableRails.config do |config|
7
- config.project_id = app.config.sendable[:project_id]
8
- config.api_key = app.config.sendable[:api_key]
7
+ if app.config.sendable[:project_id]
8
+ config.project_id = app.config.sendable[:project_id]
9
+ end
10
+
11
+ if app.config.sendable[:api_key]
12
+ config.api_key = app.config.sendable[:api_key]
13
+ end
9
14
  end
10
15
  end
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module SendableRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendable_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umair Siddique
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2017-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: 1.3.13
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: 1.3.13
47
47
  description: Sendable delivery method for ActionMailer.
48
48
  email:
49
49
  - umairsiddique@gmail.com