govdelivery-tms 0.10.0 → 0.10.1

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: 8bdc485be8147842826216f48d724ee07c7bde03
4
- data.tar.gz: 1e5d995d8cb0695a3daded617e76c4b3759605c2
3
+ metadata.gz: 80ce30c67675cf5ca2fd17540de4ec441ca4f5eb
4
+ data.tar.gz: f687a66bd95d9ea853118833ecd7b22b1d8664a5
5
5
  SHA512:
6
- metadata.gz: c1ddd27b65010b1e4371ffce2c346fb53ceea4c23d52051a591cddcade463241569bc3be75b32a01eb8dd7e47e4a0aafa7987bfc9b54ff4838c2228a3ebd19e2
7
- data.tar.gz: c9c92d45100e11774b74c77840189c3f3b7cb884230ea4403d6e419b0e7214404993cbdd1f936f85fd922141e46e86b9a38e3ca6fe7d877e128e97e516fb9fcf
6
+ metadata.gz: a7d601b3087a473619bb61b51ebeedec2e6b8f1a71eeb63ed3e81fe01bf04c6b3694c7adbdb55ab12bfc76f25c03cac1631f97fb78f24cd6e2a1659cfb4a51ff
7
+ data.tar.gz: e69055850da82be3a98a87510bdc6619c8be93f08123a77c3d9469d563bd5f079d2ad69219e2c5ca3e17544d457fee778fff0f20dce81d47e0bc37d4fdbe2987
data/README.md CHANGED
@@ -68,8 +68,7 @@ inbound_sms.attributes # {:from=>"+15005550
68
68
 
69
69
  ```ruby
70
70
  message = client.email_messages.build(:body=>'<p><a href="http://example.com">Visit here</a></p>',
71
- :subject => 'Hey',
72
- :from_email => 'foo@example.com')
71
+ :subject => 'Hey')
73
72
  message.recipients.build(:email=>'example1@example.com')
74
73
  message.recipients.build(:email=>'')
75
74
  message.post # true
@@ -91,6 +90,45 @@ message.recipients.build(:email=>'bill@example.com')
91
90
  message.post
92
91
  ```
93
92
 
93
+ #### From Addresses
94
+
95
+ From Addresses are read only resources that define which email addresses you
96
+ can send an email from and have replies and bounces sent to. From Addresses
97
+ also have an associated default display name. If you wish to send a message
98
+ from an address that is not your account's default, you will need to specify a
99
+ From Address on your Message.
100
+
101
+ To add or edit From Addresses, you will need to contact your CSC.
102
+
103
+ ```ruby
104
+ # Fetch the from_addresses on your account
105
+ client.from_addresses.get
106
+
107
+ # Get the first from address on your account
108
+ from_address = client.from_addresses.collection.first
109
+
110
+ # Lets see what the emails and display name are
111
+ puts from_address.from_email
112
+ puts from_address.reply_to_email
113
+ puts from_address.bound_email
114
+ puts from_address.from_name
115
+
116
+ # Is this from address the account's default?
117
+ puts from_address.is_default
118
+
119
+ # New messages default to using the default from_address of your account
120
+ message = client.email_messages.build(:body=>'<p><a href="http://example.com">Visit here</a></p>',
121
+ :subject => 'Hey')
122
+
123
+ # Specifiy a different from_address using the links hash
124
+ message.links[:from_address] = from_address.id
125
+
126
+ # If you want, you can override the form_name on a message
127
+ message.from_name = 'Better Name'
128
+ message.post
129
+ ```
130
+
131
+
94
132
  ### Creating an Email Template
95
133
 
96
134
  ```ruby
@@ -5,8 +5,10 @@ module GovDelivery::TMS::CoreExt
5
5
  ActiveSupport::Inflector.demodulize(path)
6
6
  end
7
7
 
8
- def classify(str)
9
- ActiveSupport::Inflector.camelize(str)
8
+ def camelize(str)
9
+ # Do not use ActiveSupport::Inflector.camelize because it uses global
10
+ # ActiveSupport::Inflector.acronum data.
11
+ str.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
10
12
  end
11
13
 
12
14
  def singularize(str)
@@ -38,7 +38,7 @@ module GovDelivery::TMS::Util
38
38
  end
39
39
 
40
40
  def relation_class(rel)
41
- ::GovDelivery::TMS.const_get(classify(rel)).tap do |klass|
41
+ ::GovDelivery::TMS.const_get(camelize(rel)).tap do |klass|
42
42
  return nil unless klass.name =~ /GovDelivery::TMS/
43
43
  end
44
44
  rescue NameError
@@ -1,5 +1,5 @@
1
1
  module GovDelivery
2
2
  module TMS #:nodoc:
3
- VERSION = '0.10.0'.freeze
3
+ VERSION = '0.10.1'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe GovDelivery::TMS::CoreExt do
4
+
5
+ subject do
6
+ Object.new.extend(described_class)
7
+ end
8
+
9
+ describe '#camelize' do
10
+ it 'should return camilized string not using inflector acronyms' do
11
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
12
+ inflect.acronym 'SMS'
13
+ end
14
+ expect(subject.camelize('sms_message')).to eq 'SmsMessage'
15
+ end
16
+ end
17
+
18
+ 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.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GovDelivery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -111,6 +111,7 @@ files:
111
111
  - lib/govdelivery/tms/version.rb
112
112
  - spec/client_spec.rb
113
113
  - spec/command_types_spec.rb
114
+ - spec/core_ext_spec.rb
114
115
  - spec/email_message_spec.rb
115
116
  - spec/email_template_spec.rb
116
117
  - spec/errors_spec.rb
@@ -144,13 +145,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  version: '0'
145
146
  requirements: []
146
147
  rubyforge_project:
147
- rubygems_version: 2.2.3
148
+ rubygems_version: 2.5.2
148
149
  signing_key:
149
150
  specification_version: 4
150
151
  summary: A ruby client to interact with the GovDelivery TMS REST API.
151
152
  test_files:
152
153
  - spec/client_spec.rb
153
154
  - spec/command_types_spec.rb
155
+ - spec/core_ext_spec.rb
154
156
  - spec/email_message_spec.rb
155
157
  - spec/email_template_spec.rb
156
158
  - spec/errors_spec.rb