govdelivery-tms 0.8.14 → 0.9.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: 51b89c07fa8d0c31f66bce53608b201b6daf8ecd
4
- data.tar.gz: 84f4f2da057c5b9e8ae8661b2d4c208450816ed9
3
+ metadata.gz: 09c0b3dc04ff867cb20f04b6a03e3b252d8a236a
4
+ data.tar.gz: 24b27bf686f91b8f2599bd32aa6605e9ff266338
5
5
  SHA512:
6
- metadata.gz: fa4453542a0a3c02ee8033a42293eed23df34b624f51151e54e06527f7c2a8bdfa3b8082ed427e25136fa3e18d48e4a717302db28a19ac5635b38812af82b5bd
7
- data.tar.gz: 75d621d0d314d42c21a6877ce49793461f7fb40695c62d5fe256378e6cca20a3033c9382ece8ba965103c9748cc27e7683e4296aaf3b23ac5111951bca17cc8d
6
+ metadata.gz: 1ac643e82b7693cdf4be4777d4d330dd88e5303556cf49ae6607b5c031b75f57456ffa099e4b66fd692d5334038a6f5961d10785622e5bc565b0d8c5019b9ebe
7
+ data.tar.gz: 1d8ce76b6c4cceec11b39233284284369cfce9d0481e5f09bab2f3571f2a5b32956c86c09816ce9d8c4751222f51fb69a3c32aa08c927ac0d49c6908997a7094
@@ -31,6 +31,7 @@ require 'govdelivery/tms/resource/sms_message'
31
31
  require 'govdelivery/tms/resource/email_message'
32
32
  require 'govdelivery/tms/resource/inbound_sms_message'
33
33
  require 'govdelivery/tms/resource/command_type'
34
+ require 'govdelivery/tms/resource/message_type'
34
35
  require 'govdelivery/tms/resource/command_action'
35
36
  require 'govdelivery/tms/resource/command'
36
37
  require 'govdelivery/tms/resource/keyword'
@@ -73,6 +73,10 @@ class GovDelivery::TMS::EmailTemplates
73
73
  include GovDelivery::TMS::CollectionResource
74
74
  end
75
75
 
76
+ class GovDelivery::TMS::MessageTypes
77
+ include GovDelivery::TMS::CollectionResource
78
+ end
79
+
76
80
  class GovDelivery::TMS::SmsTemplates
77
81
  include GovDelivery::TMS::CollectionResource
78
82
  end
@@ -50,6 +50,7 @@ module GovDelivery::TMS #:nodoc:
50
50
  :from_email,
51
51
  :from_name,
52
52
  :macros,
53
+ :message_type_code,
53
54
  :open_tracking_enabled,
54
55
  :reply_to,
55
56
  :subject
@@ -77,6 +78,6 @@ module GovDelivery::TMS #:nodoc:
77
78
  # A CollectionResource of EmailRecipients that failed, not neccessarily bounced
78
79
  collection_attribute :failed, 'EmailRecipients'
79
80
 
80
- linkable_attributes :email_template
81
+ linkable_attributes :email_template, :message_type
81
82
  end
82
83
  end
@@ -3,9 +3,16 @@ 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, :uuid
6
+ writeable_attributes :body,
7
+ :subject,
8
+ :link_tracking_parameters,
9
+ :macros,
10
+ :message_type_code,
11
+ :open_tracking_enabled,
12
+ :click_tracking_enabled,
13
+ :uuid
7
14
 
8
- linkable_attributes :from_address
15
+ linkable_attributes :from_address, :message_type
9
16
 
10
17
  # @!parse attr_reader :id, :created_at
11
18
  readonly_attributes :id, :created_at
@@ -0,0 +1,16 @@
1
+ module GovDelivery::TMS #:nodoc:
2
+ # A MessageType is a like a tag that can be attached to an EmailTemplate or an
3
+ # EmailMessage. It is included in encoded links and can be used as a
4
+ # Segmentation filter.
5
+ #
6
+ #
7
+ # @attr code [String] The unique identifier of the MessageType.
8
+ # @attr label [String] User facing description
9
+ #
10
+ class MessageType
11
+ include InstanceResource
12
+
13
+ # @!parse attr_reader :code, :label
14
+ writeable_attributes :code, :label
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module GovDelivery
2
2
  module TMS #:nodoc:
3
- VERSION = '0.8.14'
3
+ VERSION = '0.9.0'
4
4
  end
5
5
  end
@@ -86,7 +86,10 @@ 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/new-template', 'email_template' => '/templates/email/new-template' }
89
+ 'message_type_code' => 'salutations',
90
+ '_links' => { 'self' => '/messages/email/new-template',
91
+ 'message_type' => '/message_type/abc',
92
+ 'email_template' => '/templates/email/new-template' }
90
93
  }
91
94
  expect(@message.client).to receive('get').with(@message.href).and_return(double('response', status: 200, body: response))
92
95
  @message.get
@@ -96,7 +99,9 @@ describe GovDelivery::TMS::EmailMessage do
96
99
  expect(@message.reply_to).to eq('replyto@evotest.govdelivery.com')
97
100
  expect(@message.errors_to).to eq('errors@evotest.govdelivery.com')
98
101
  expect(@message.created_at).to eq('time')
102
+ expect(@message.message_type_code).to eq('salutations')
99
103
  expect(@message.email_template).to be_a(GovDelivery::TMS::EmailTemplate)
104
+ expect(@message.message_type).to be_a(GovDelivery::TMS::MessageType)
100
105
  end
101
106
  end
102
107
  end
@@ -79,8 +79,12 @@ describe GovDelivery::TMS::EmailTemplate do
79
79
  'macros' => { 'MACRO1' => '1' },
80
80
  'open_tracking_enabled' => true,
81
81
  'click_tracking_enabled' => true,
82
+ 'message_type_code' => 'salutations',
82
83
  'created_at' => 'sometime',
83
- '_links' => { 'self' => '/templates/email/new-template', 'account' => '/accounts/1', 'from_address' => '/from_addresses/1' }
84
+ '_links' => { 'self' => '/templates/email/new-template',
85
+ 'account' => '/accounts/1',
86
+ 'message_type' => '/message_types/abc',
87
+ 'from_address' => '/from_addresses/1' }
84
88
  }
85
89
  expect(@template.client).to receive('post').with(@template).and_return(double('response', status: 201, body: response))
86
90
  @template.post
@@ -92,8 +96,10 @@ describe GovDelivery::TMS::EmailTemplate do
92
96
  expect(@template.macros).to eq('MACRO1' => '1')
93
97
  expect(@template.open_tracking_enabled).to eq(true)
94
98
  expect(@template.click_tracking_enabled).to eq(true)
99
+ expect(@template.message_type_code).to eql('salutations')
95
100
  expect(@template.created_at).to eq('sometime')
96
101
  expect(@template.from_address).to be_a(GovDelivery::TMS::FromAddress)
102
+ expect(@template.message_type).to be_a(GovDelivery::TMS::MessageType)
97
103
  end
98
104
  end
99
105
 
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe GovDelivery::TMS::MessageTypes do
4
+ context 'loading message types' do
5
+ let(:client) do
6
+ double('client')
7
+ end
8
+ before do
9
+ @message_types = GovDelivery::TMS::MessageTypes.new(client, '/message_types')
10
+ end
11
+
12
+ it 'should GET ok' do
13
+ body = [{ 'code' => 'dcm_unsubscribe',
14
+ 'label' => 'Unsubcribe' }]
15
+ expect(@message_types.client).to receive(:get).and_return(double('response', body: body, status: 200, headers: {}))
16
+ @message_types.get
17
+ expect(@message_types.collection.length).to eq(1)
18
+ ct = @message_types.collection.first
19
+ expect(ct.code).to eq('dcm_unsubscribe')
20
+ expect(ct.label).to eq('Unsubcribe')
21
+ end
22
+
23
+ it 'should update label if changed' do
24
+ @message_type = GovDelivery::TMS::MessageType.new(client, '/message_types', {code: 'dcm_unsubscribe'})
25
+ response = { code: 'dcm_unsubscribe',
26
+ label: 'Dcm Unsubscribe' }
27
+
28
+ expect(@message_type.client).to receive(:post).and_return(double('response', body: response, status: 200, headers: {}))
29
+ @message_type.post
30
+ expect(@message_type.label).to eql('Dcm Unsubscribe')
31
+ end
32
+ end
33
+ end
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.14
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GovDelivery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -87,6 +87,7 @@ files:
87
87
  - lib/govdelivery/tms/resource/from_address.rb
88
88
  - lib/govdelivery/tms/resource/inbound_sms_message.rb
89
89
  - lib/govdelivery/tms/resource/keyword.rb
90
+ - lib/govdelivery/tms/resource/message_type.rb
90
91
  - lib/govdelivery/tms/resource/recipient.rb
91
92
  - lib/govdelivery/tms/resource/sms_message.rb
92
93
  - lib/govdelivery/tms/resource/sms_template.rb
@@ -105,6 +106,7 @@ files:
105
106
  - spec/keyword_spec.rb
106
107
  - spec/keywords_spec.rb
107
108
  - spec/mail/delivery_method_spec.rb
109
+ - spec/message_types_spec.rb
108
110
  - spec/sms_message_spec.rb
109
111
  - spec/sms_messages_spec.rb
110
112
  - spec/spec_helper.rb
@@ -128,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
130
  version: '0'
129
131
  requirements: []
130
132
  rubyforge_project:
131
- rubygems_version: 2.4.8
133
+ rubygems_version: 2.2.3
132
134
  signing_key:
133
135
  specification_version: 4
134
136
  summary: A ruby client to interact with the GovDelivery TMS REST API.
@@ -144,6 +146,7 @@ test_files:
144
146
  - spec/keyword_spec.rb
145
147
  - spec/keywords_spec.rb
146
148
  - spec/mail/delivery_method_spec.rb
149
+ - spec/message_types_spec.rb
147
150
  - spec/sms_message_spec.rb
148
151
  - spec/sms_messages_spec.rb
149
152
  - spec/spec_helper.rb