cordial 0.1.8 → 0.1.9

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: ca629fe17afd35692f72597083ddeb0f1357fbc6
4
- data.tar.gz: c804b876ab4b7574db1113f767b574c7c4b27036
3
+ metadata.gz: 32486d0b27bda385f28565ae7c1de68b872b8c79
4
+ data.tar.gz: 1da12854930002459b157d488b06cbb7d18deb15
5
5
  SHA512:
6
- metadata.gz: e9de75189f76b305c1a0a5d7d8c63dad4a6e4ca7d1d7209b959d0616a256b15e7a1659ce6c5bd0ef27758a85a69e1650b1328ecf3d028e13bc9ece1abea59cb4
7
- data.tar.gz: fd498b8a49fb9112bf9214835062de8d28a5986ee58adeae8c39e5d9c8d26169348cfbf35a426a5bb93d5f30cdacc1b8bed57f551dc4a596a8fc1f8be20509a7
6
+ metadata.gz: baa46837e8d91ff11933eff14aa5e45620f55b1e52727aed0174c25bb11dacb2e8ceb247a68c752003f2c31563134e41113d27afd54cc68a144e58ad768a63c4
7
+ data.tar.gz: 6d699f90c7c3be675782efef560f6e411f00c2c1a51b0c47ad5321a1450eed28ef9a6cadd9d9e450a0b8a88c0f0876ca2347869ea31793bf37f573a2e301da55
@@ -0,0 +1,56 @@
1
+ module Cordial
2
+ # Wraps all interaction with the Automation Templates resource.
3
+ # @see https://api.cordial.io/docs/v1/#!/automation_templates
4
+ class AutomationTemplates
5
+ include ::HTTParty
6
+ extend Client
7
+
8
+ # Create a new message template.
9
+ #
10
+ # @example Usage.
11
+ # Cordial::AutomationTemplates.create(
12
+ # key: "promo_01_20_2018",
13
+ # name: "promo_01_20_2018",
14
+ # channel: "email",
15
+ # classification: "promotional",
16
+ # base_aggregation: "hourly",
17
+ # headers:{
18
+ # subject_email: "One Day Only Sale",
19
+ # from_email: "info@example.com",
20
+ # reply_email: "info@example.com",
21
+ # from_description: "Promotions Team"
22
+ # },
23
+ # content:{
24
+ # text: "<div>Hello World</div>"
25
+ # }
26
+ # )
27
+ #
28
+ # @example successful response
29
+ # {"success"=>true, "message"=>"record created"}
30
+ #
31
+ # @example failed response
32
+ # {"error"=>true, "messages"=>"KEY must be unique"}
33
+ #
34
+ def self.create(key:, name:, channel:, classification:, base_aggregation:, headers:, content:)
35
+ client.post('/automationtemplates',
36
+ body: {
37
+ key: key,
38
+ name: name,
39
+ channel: channel,
40
+ classification: classification,
41
+ baseAggregation: base_aggregation,
42
+ message: {
43
+ headers: {
44
+ subject: headers[:subject_email],
45
+ fromEmail: headers[:from_email],
46
+ replyEmail: headers[:reply_email],
47
+ fromDesc: headers[:from_description]
48
+ },
49
+ content: {
50
+ "text/html": content[:text]
51
+ }
52
+ }
53
+ }.to_json)
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module Cordial
2
- VERSION = '0.1.8'.freeze
2
+ VERSION = '0.1.9'.freeze
3
3
  end
data/lib/cordial.rb CHANGED
@@ -5,6 +5,7 @@ require "cordial/client"
5
5
  require "cordial/contacts"
6
6
  require "cordial/products"
7
7
  require "cordial/orders"
8
+ require "cordial/automation_templates"
8
9
 
9
10
  module Cordial
10
11
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cordial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -156,6 +156,7 @@ files:
156
156
  - bin/setup
157
157
  - cordial.gemspec
158
158
  - lib/cordial.rb
159
+ - lib/cordial/automation_templates.rb
159
160
  - lib/cordial/client.rb
160
161
  - lib/cordial/contacts.rb
161
162
  - lib/cordial/orders.rb