tms_client 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,7 +51,7 @@ message.href # "/messages/sms/87"
51
51
  message.get # <TMS::SmsMessage href=/messages/sms/87 attributes={...}>
52
52
  ```
53
53
 
54
- ### Sending an Email
54
+ ### Sending an Email Message
55
55
 
56
56
  ```ruby
57
57
  message = client.email_messages.build(:body=>'<p><a href="http://example.com">Visit here</a>',
@@ -3,14 +3,16 @@ module TMS #:nodoc:
3
3
  # objects. Certain metrics are available after the email is sent, including
4
4
  # the collection of recipients who clicked or opened the email.
5
5
  #
6
- # @attr from_name [String] The name of the person or entity sending the email.
7
- # @attr from_email [String] The email adderess of the person or entity sending the email. Must be configured in TMS beforehand. Defaults to the account default from address.
8
- # @attr subject [String] The subject of the email
9
- # @attr body [String] The body of the email
10
- # @attr open_tracking_enabled [Boolean] Whether to track opens on this message. Optional, defaults to true.
11
- # @attr click_tracking_enabled [Boolean] Whether to track clicks on links in this message. Optional, defaults to true.
12
- # @attr macros [Hash] A dictionary of key/value pairs to use in the subject and body as default macros.
13
- # The message-level macros are used when a recipient has no value for a given macro key.
6
+ # @attr from_name [String] The name of the person or entity sending the email.
7
+ # @attr from_email [String] Optional - the email address of the person or entity sending the email. Must be configured in TMS beforehand. Defaults to the account default from address.
8
+ # @attr reply_to [String] Optional - the email address used for the Reply-To header of this email. Defaults to the account default reply_to_email address (which itself defaults to the default from address if not specified).
9
+ # @attr errors_to [String] Optional - the email address used for the Errors-To header of this email. Defaults to the account default bounce_email address (which itself defaults to the default from address if not specified).
10
+ # @attr subject [String] The subject of the email.
11
+ # @attr body [String] The body of the email.
12
+ # @attr open_tracking_enabled [Boolean] Optional - Whether to track opens on this message. Defaults to true.
13
+ # @attr click_tracking_enabled [Boolean] Optional - Whether to track clicks on links in this message. Defaults to true.
14
+ # @attr macros [Hash] Optional - A dictionary of key/value pairs to use in the subject and body as default macros.
15
+ # The message-level macros are used when a recipient has no value for a given macro key.
14
16
  #
15
17
  # @example Sending a message
16
18
  # email_message = client.email_messages.build(:subject => "Great news!",
@@ -41,8 +43,17 @@ module TMS #:nodoc:
41
43
  class EmailMessage
42
44
  include InstanceResource
43
45
 
44
- # @!parse attr_accessor :body, :from_name, :from_email, :subject, :open_tracking_enabled, :click_tracking_enabled, :macros
45
- writeable_attributes :body, :from_name, :from_email, :subject, :open_tracking_enabled, :click_tracking_enabled, :macros
46
+ # @!parse attr_accessor :body, :from_name, :from_email, :reply_to, :errors_to, :subject, :open_tracking_enabled, :click_tracking_enabled, :macros
47
+ writeable_attributes :body,
48
+ :click_tracking_enabled,
49
+ :errors_to,
50
+ :from_email,
51
+ :from_name,
52
+ :macros,
53
+ :open_tracking_enabled,
54
+ :reply_to,
55
+ :subject
56
+
46
57
 
47
58
  # @!parse attr_reader :created_at, :status
48
59
  readonly_attributes :created_at, :status
@@ -1,3 +1,3 @@
1
1
  module TMS #:nodoc:
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -6,29 +6,44 @@ describe TMS::EmailMessage do
6
6
  double('client')
7
7
  end
8
8
  before do
9
- @message = TMS::EmailMessage.new(client, nil, {:body => '12345678',
10
- :subject => 'blah',
11
- :created_at => 'BAAAAAD',
12
- :from_email => 'eric@evotest.govdelivery.com'})
9
+ @message = TMS::EmailMessage.new(client, nil, {
10
+ :body => '12345678',
11
+ :subject => 'blah',
12
+ :created_at => 'BAAAAAD',
13
+ :from_email => 'eric@evotest.govdelivery.com',
14
+ :errors_to => 'errors@evotest.govdelivery.com',
15
+ :reply_to => 'replyto@evotest.govdelivery.com'})
13
16
  end
14
17
  it 'should not render readonly attrs in json hash' do
15
18
  @message.to_json[:body].should == '12345678'
16
19
  @message.to_json[:created_at].should == nil
17
20
  end
18
21
  it 'should initialize with attrs and collections' do
19
- @message.body.should == '12345678'
20
- @message.subject.should == 'blah'
21
- @message.from_email.should == 'eric@evotest.govdelivery.com'
22
+ @message.body.should == '12345678'
23
+ @message.subject.should == 'blah'
24
+ @message.from_email.should == 'eric@evotest.govdelivery.com'
25
+ @message.reply_to.should == 'replyto@evotest.govdelivery.com'
26
+ @message.errors_to.should == 'errors@evotest.govdelivery.com'
22
27
  @message.recipients.class.should == TMS::EmailRecipients
23
28
  end
24
29
  it 'should post successfully' do
25
- response = {:body => 'processed', :subject => 'blah', :from_email => 'eric@evotest.govdelivery.com',
26
- :recipients => [{:email => 'billy@evotest.govdelivery.com'}], :created_at => 'time'}
30
+ response = {
31
+ :body => 'processed',
32
+ :subject => 'blah',
33
+ :from_email => 'eric@evotest.govdelivery.com',
34
+ :errors_to => 'errors@evotest.govdelivery.com',
35
+ :reply_to => 'replyto@evotest.govdelivery.com',
36
+ :recipients => [{:email => 'billy@evotest.govdelivery.com'}],
37
+ :created_at => 'time'
38
+ }
27
39
  @message.client.should_receive('post').with(@message).and_return(double('response', :status => 201, :body => response))
28
40
  @message.post
29
- @message.body.should == 'processed'
30
- @message.created_at.should == 'time'
31
- @message.recipients.class.should == TMS::EmailRecipients
41
+ @message.body.should == 'processed'
42
+ @message.created_at.should == 'time'
43
+ @message.from_email.should == 'eric@evotest.govdelivery.com'
44
+ @message.reply_to.should == 'replyto@evotest.govdelivery.com'
45
+ @message.errors_to.should == 'errors@evotest.govdelivery.com'
46
+ @message.recipients.class.should == TMS::EmailRecipients
32
47
  @message.recipients.collection.first.class.should == TMS::EmailRecipient
33
48
  end
34
49
  it 'should handle errors' do
@@ -50,14 +65,19 @@ describe TMS::EmailMessage do
50
65
  end
51
66
  it 'should GET cleanly' do
52
67
  response = {:body => 'processed',
53
- :subject => 'hey',
68
+ :subject => 'hey',
54
69
  :from_email => 'eric@evotest.govdelivery.com',
55
- :recipients => [{:email => 'billy@evotest.govdelivery.com'}], :created_at => 'time'}
70
+ :errors_to => 'errors@evotest.govdelivery.com',
71
+ :reply_to => 'replyto@evotest.govdelivery.com',
72
+ :recipients => [{:email => 'billy@evotest.govdelivery.com'}],
73
+ :created_at => 'time'}
56
74
  @message.client.should_receive('get').with(@message.href).and_return(double('response', :status => 200, :body => response))
57
75
  @message.get
58
- @message.body.should == 'processed'
59
- @message.subject.should == 'hey'
76
+ @message.body.should == 'processed'
77
+ @message.subject.should == 'hey'
60
78
  @message.from_email.should == 'eric@evotest.govdelivery.com'
79
+ @message.reply_to.should == 'replyto@evotest.govdelivery.com'
80
+ @message.errors_to.should == 'errors@evotest.govdelivery.com'
61
81
  @message.created_at.should == 'time'
62
82
  end
63
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tms_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-25 00:00:00.000000000 Z
12
+ date: 2013-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -122,12 +122,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ segments:
126
+ - 0
127
+ hash: 825628313063111602
125
128
  required_rubygems_version: !ruby/object:Gem::Requirement
126
129
  none: false
127
130
  requirements:
128
131
  - - ! '>='
129
132
  - !ruby/object:Gem::Version
130
133
  version: '0'
134
+ segments:
135
+ - 0
136
+ hash: 825628313063111602
131
137
  requirements: []
132
138
  rubyforge_project:
133
139
  rubygems_version: 1.8.25
@@ -147,4 +153,3 @@ test_files:
147
153
  - spec/sms_messages_spec.rb
148
154
  - spec/spec_helper.rb
149
155
  - spec/tms_client_spec.rb
150
- has_rdoc: