govdelivery-tms 0.8.13 → 0.8.14

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: f4c809d0aadd126462e72f5d5e3b7363cff48d4b
4
- data.tar.gz: e660e0a18164669f7a0aeac59b52db1e3342135c
3
+ metadata.gz: 51b89c07fa8d0c31f66bce53608b201b6daf8ecd
4
+ data.tar.gz: 84f4f2da057c5b9e8ae8661b2d4c208450816ed9
5
5
  SHA512:
6
- metadata.gz: 53ccde106bdf2e4d213b3294ec9a9a5940eada7121782347edb890a425409d4e98ab93b29d4883197b1510247cedd0ef59529db06a454554f4f4053b137e8d93
7
- data.tar.gz: d8e4f3dade334caf13b5abfde055f65573abbc6c85f07632ac1b218cbcb3313502342c6321bb9de982f2bcd3811a5adc18d8258c1705e33d1682eb246461932e
6
+ metadata.gz: fa4453542a0a3c02ee8033a42293eed23df34b624f51151e54e06527f7c2a8bdfa3b8082ed427e25136fa3e18d48e4a717302db28a19ac5635b38812af82b5bd
7
+ data.tar.gz: 75d621d0d314d42c21a6877ce49793461f7fb40695c62d5fe256378e6cca20a3033c9382ece8ba965103c9748cc27e7683e4296aaf3b23ac5111951bca17cc8d
data/README.md CHANGED
@@ -67,7 +67,7 @@ inbound_sms.attributes # {:from=>"+15005550
67
67
  ### Sending an Email Message
68
68
 
69
69
  ```ruby
70
- message = client.email_messages.build(:body=>'<p><a href="http://example.com">Visit here</a>',
70
+ message = client.email_messages.build(:body=>'<p><a href="http://example.com">Visit here</a></p>',
71
71
  :subject => 'Hey',
72
72
  :from_email => 'foo@example.com')
73
73
  message.recipients.build(:email=>'example1@example.com')
@@ -94,25 +94,69 @@ message.post
94
94
  ### Creating an Email Template
95
95
 
96
96
  ```ruby
97
- template = client.email_templates.build(subject: 'A templated subject',
97
+ template = client.email_templates.build(uuid: 'a-new-template',
98
+ subject: 'A templated subject',
98
99
  body: 'Hi [[name]], this body is from a template.',
99
100
  macros: {"name"=>"person"})
100
101
  template.post
101
102
  ```
102
103
 
104
+ ### Updating an Email Template
105
+
106
+ *Note: `uuid` cannot be updated.*
107
+
108
+ ```ruby
109
+ template = client.email_templates.build(:href => 'template/email/a-new-template')
110
+ template.get
111
+ template.body = 'Hi [[name]], this body is from a new template.'
112
+ template.put
113
+ ```
114
+
103
115
  ### Sending an Email using a Template
104
116
 
105
117
  Assuming you created `template` above:
106
118
 
107
119
  ```ruby
108
120
  message = client.email_messages.build
109
- message.links[:email_template] = template.id
121
+ message.links[:email_template] = template.uuid
110
122
  message.recipients.build(:email=>'jim@example.com', :macros=>{"name"=>"Jim"})
111
123
  message.recipients.build(:email=>'amy@example.com', :macros=>{"name"=>"Amy"})
112
124
  message.recipients.build(:email=>'bill@example.com')
113
125
  message.post
114
126
  ```
115
127
 
128
+ ### Creating an SMS Template
129
+
130
+ ```ruby
131
+ template = client.sms_templates.build(uuid: 'a_new-template',
132
+ body: 'Hi, [[name]] this is a tempalte.')
133
+ template.post
134
+ ```
135
+
136
+ ### Updating an SMS Template
137
+
138
+ *Note: `uuid` cannot be updated.*
139
+
140
+ ```ruby
141
+ template = client.sms_templates.build(href: 'template/sms/a_new-template')
142
+ template.get
143
+ template.body = 'Hi, [[name]] this is a new tempalte.'
144
+ template.put
145
+ ```
146
+
147
+ ### Sending an SMS Message using a Template
148
+
149
+ Assuming you've created `template` above:
150
+
151
+ ```ruby
152
+ message = client.email_messages.build
153
+ message.links[:sms_template] = template.uuid
154
+ message.recipients.build(:phone=>'5551112222')
155
+ message.recipients.build(:phone=>'5551112223')
156
+ message.post
157
+ ```
158
+
159
+
116
160
  Webhooks
117
161
  -------
118
162
  ### POST to a URL when a recipient is blacklisted (i.e. to remove from your list)
@@ -3,7 +3,7 @@ module GovDelivery::TMS #:nodoc:
3
3
  include InstanceResource
4
4
 
5
5
  # @!parse attr_accessor :body, :subject, :link_tracking_parameters, :macros, :open_tracking_enabled, :click_tracking_enabled
6
- writeable_attributes :body, :subject, :link_tracking_parameters, :macros, :open_tracking_enabled, :click_tracking_enabled
6
+ writeable_attributes :body, :subject, :link_tracking_parameters, :macros, :open_tracking_enabled, :click_tracking_enabled, :uuid
7
7
 
8
8
  linkable_attributes :from_address
9
9
 
@@ -3,7 +3,7 @@ module GovDelivery::TMS #:nodoc:
3
3
  include InstanceResource
4
4
 
5
5
  # @!parse attr_accessor :body
6
- writeable_attributes :body
6
+ writeable_attributes :body, :uuid
7
7
 
8
8
  # @!parse attr_reader :id, :created_at
9
9
  readonly_attributes :id, :created_at
@@ -1,5 +1,5 @@
1
1
  module GovDelivery
2
2
  module TMS #:nodoc:
3
- VERSION = '0.8.13'
3
+ VERSION = '0.8.14'
4
4
  end
5
5
  end
@@ -86,7 +86,7 @@ describe GovDelivery::TMS::EmailMessage do
86
86
  'reply_to' => 'replyto@evotest.govdelivery.com',
87
87
  'recipients' => [{ email: 'billy@evotest.govdelivery.com' }],
88
88
  'created_at' => 'time',
89
- '_links' => { 'self' => '/messages/email/1', 'email_template' => '/templates/email/1' }
89
+ '_links' => { 'self' => '/messages/email/new-template', 'email_template' => '/templates/email/new-template' }
90
90
  }
91
91
  expect(@message.client).to receive('get').with(@message.href).and_return(double('response', status: 200, body: response))
92
92
  @message.get
@@ -13,6 +13,7 @@ describe GovDelivery::TMS::EmailTemplate do
13
13
  response = [
14
14
  {
15
15
  'id' => '1',
16
+ 'uuid' => 'new-template',
16
17
  'body' => 'Template 1',
17
18
  'subject' => 'This is the template 1 subject',
18
19
  'link_tracking_parameters' => 'test=ok&hello=world',
@@ -20,7 +21,7 @@ describe GovDelivery::TMS::EmailTemplate do
20
21
  'open_tracking_enabled' => true,
21
22
  'click_tracking_enabled' => true,
22
23
  'created_at' => 'sometime',
23
- '_links' => { 'self' => '/templates/email/1', 'account' => '/accounts/1', 'from_address' => '/from_addresses/1' }
24
+ '_links' => { 'self' => '/templates/email/new-template', 'account' => '/accounts/1', 'from_address' => '/from_addresses/1' }
24
25
  }
25
26
  ]
26
27
 
@@ -35,7 +36,8 @@ describe GovDelivery::TMS::EmailTemplate do
35
36
  double('client')
36
37
  end
37
38
  before do
38
- @template = GovDelivery::TMS::EmailTemplate.new(client, '/templates/email', body: 'Template 1',
39
+ @template = GovDelivery::TMS::EmailTemplate.new(client, '/templates/email', uuid: 'new-template',
40
+ body: 'Template 1',
39
41
  subject: 'This is the template 1 subject',
40
42
  link_tracking_parameters: 'test=ok&hello=world',
41
43
  macros: { 'MACRO1' => '1' },
@@ -70,6 +72,7 @@ describe GovDelivery::TMS::EmailTemplate do
70
72
  it 'should post successfully' do
71
73
  response = {
72
74
  'id' => '1',
75
+ 'uuid' => 'new-template',
73
76
  'body' => 'Template 1',
74
77
  'subject' => 'This is the template 1 subject',
75
78
  'link_tracking_parameters' => 'test=ok&hello=world',
@@ -77,11 +80,12 @@ describe GovDelivery::TMS::EmailTemplate do
77
80
  'open_tracking_enabled' => true,
78
81
  'click_tracking_enabled' => true,
79
82
  'created_at' => 'sometime',
80
- '_links' => { 'self' => '/templates/email/1', 'account' => '/accounts/1', 'from_address' => '/from_addresses/1' }
83
+ '_links' => { 'self' => '/templates/email/new-template', 'account' => '/accounts/1', 'from_address' => '/from_addresses/1' }
81
84
  }
82
85
  expect(@template.client).to receive('post').with(@template).and_return(double('response', status: 201, body: response))
83
86
  @template.post
84
87
  expect(@template.id).to eq('1')
88
+ expect(@template.uuid).to eq('new-template')
85
89
  expect(@template.body).to eq('Template 1')
86
90
  expect(@template.subject).to eq('This is the template 1 subject')
87
91
  expect(@template.link_tracking_parameters).to eq('test=ok&hello=world')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govdelivery-tms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.13
4
+ version: 0.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - GovDelivery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.4.5.1
131
+ rubygems_version: 2.4.8
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: A ruby client to interact with the GovDelivery TMS REST API.