textris 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -13
  3. metadata +23 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f1998dcf38ee77fccc6357527ad6129fe3ce6e7
4
- data.tar.gz: 84953db540e4d1ceff87f3d44157d98df7727f55
3
+ metadata.gz: 4ba73d33c35ee5b623025045060cf7a030f899ed
4
+ data.tar.gz: 1a593b72d843f7a91c68dea1146ed4935c55d544
5
5
  SHA512:
6
- metadata.gz: 0a2d83ecaaf191b1e3a0e8cca147f76d2ee0bbd5e175ae9c249f6986f8934d4fd58bae41499a0771dfacf25a9b36558b2fa06f74f9197cde7446060fd13dfe51
7
- data.tar.gz: d47fceee3c971d97f4025d97dc306c3bb3631f031349ff465360b579ca9beaa9f161a32592a58c5a49c4ab7b9870191d8adfa727aa8f394b3a4d10252eb0f0fb
6
+ metadata.gz: 1c15ad890fecb9796c37fd69fa89beb260d258cb8c46531bcdc7618c0c15cbee6094a3632e7a40de32d2e2e9d13390d142c4590f639fdb667b60767f28cdb795
7
+ data.tar.gz: dfad82c93b9e866a280d4bd98dfeca44b4c340e66ee5402645155fb852a74f12146402fe15962baf0230ee31c012e9a75846700bb926f80c7167639f729a44cc
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Textris
1
+ # textris
2
2
 
3
3
  Simple gem for implementing texter classes which allow sending SMS messages in similar way to how e-mails are implemented and sent with ActionMailer-based mailers.
4
4
 
5
- Unlike similar gems, **Textris** has some unique features:
5
+ Unlike similar gems, **textris** has some unique features:
6
6
 
7
7
  - e-mail proxy allowing to inspect messages using [Mailinator](https://mailinator.com/) or similar service
8
8
  - phone number E164 validation and normalization with the [phony](https://github.com/floere/phony) gem
@@ -58,7 +58,7 @@ end
58
58
 
59
59
  ### Twilio
60
60
 
61
- In order to use Twilio with textris, you must pre-configure the *twilio-ruby* settings. Create the `config/initializers/twilio.rb`:
61
+ In order to use Twilio with **textris**, you must pre-configure the *twilio-ruby* settings. Create the `config/initializers/twilio.rb`:
62
62
 
63
63
  ```ruby
64
64
  Twilio.configure do |config|
@@ -67,21 +67,21 @@ Twilio.configure do |config|
67
67
  end
68
68
  ```
69
69
 
70
- > Unless otherwise [configured](#configuration), Twilio will be the default delivery method in `development` and `production` environment, while the `test` method will be used in (surprise, surprise) `test` environment by default.
70
+ > Unless otherwise [configured](#configuration), *Twilio* will be the default delivery method in `development` and `production` environment, while the *test* method will be used in (surprise, surprise) `test` environment by default.
71
71
 
72
72
  ### Custom delivery methods
73
73
 
74
- Currently, textris comes with `twilio`, `test` and `mail` delivery methods built-in, but you can easily implement your own. Place desired delivery method class in `app/deliveries/<name>_delivery.rb` (e.g. `app/deliveries/my_provider_delivery.rb`):
74
+ Currently, **textris** comes with `twilio`, `test` and `mail` delivery methods built-in, but you can easily implement your own. Place desired delivery class in `app/deliveries/<name>_delivery.rb` (e.g. `app/deliveries/my_provider_delivery.rb`):
75
75
 
76
76
  ```ruby
77
77
  class MyProviderDelivery < Textris::Delivery::Base
78
78
  # Implement sending message to single phone number
79
- self.send_message(phone, message)
79
+ def self.send_message(phone, message)
80
80
  some_send_method(:phone => phone, :text => message.content)
81
81
  end
82
82
 
83
83
  # ...or implement sending message to multiple phone numbers at once
84
- self.send_message_to_all(message)
84
+ def self.send_message_to_all(message)
85
85
  other_send_method(:phone_array => message.to, :text => message.content)
86
86
  end
87
87
  end
@@ -89,7 +89,7 @@ end
89
89
 
90
90
  Only one of methods above must be implemented for the delivery class to work. In case of multiple phone numbers and no implementation of *send_message_to_all*, the *send_message* method will be invoked multiple times.
91
91
 
92
- > **NOTE**: You can also place your custom deliveries in `app/texters` if you don't want to clutter the *app* directory too much.
92
+ > You can place your custom deliveries in `app/texters` instead of `app/deliveries` if you don't want to clutter the *app* directory too much.
93
93
 
94
94
  After implementing your own deliveries, you can activate them by setting app configuration:
95
95
 
@@ -129,7 +129,7 @@ will yield multiple message deliveries, each for specific phone number.
129
129
 
130
130
  You can change default settings by placing them in any of environment files, like `development.rb` or `test.rb`, or setting them globally in `application.rb`.
131
131
 
132
- Choose the delivery method:
132
+ ### Choosing and chaining delivery methods
133
133
 
134
134
  ```ruby
135
135
  # Send messages via the Twilio REST API using the twilio-ruby gem
@@ -145,15 +145,19 @@ config.textris_delivery_method = :mail
145
145
  config.textris_delivery_method = [:mail, :test]
146
146
  ```
147
147
 
148
- Configure the mail delivery with custom templates:
148
+ ### Configuring the mail delivery
149
149
 
150
- ```ruby
151
- # E-mail sender, here: "our-team-48666777888@test.app-name.com"
152
- config.textris_mail_from_template = '%{from_name:d}-%{from_phone}@%{env:d}.%{app:d}.com'
150
+ **textris** comes with reasonable defaults for the `mail` delivery method. It will send messages to a Mailinator address specific to the application name, environment and target phone number. You can customize the mail delivery by setting appropriate templates presented below.
151
+
152
+ > Arguably, the *textris_mail_to_template* setting is the most important here as it specifies the target e-mail address scheme.
153
153
 
154
+ ```ruby
154
155
  # E-mail target, here: "app-name-test-48111222333-texts@mailinator.com"
155
156
  config.textris_mail_to_template = '%{app:d}-%{env:d}-%{to_phone}-texts@mailinator.com'
156
157
 
158
+ # E-mail sender, here: "our-team-48666777888@test.app-name.com"
159
+ config.textris_mail_from_template = '%{from_name:d}-%{from_phone}@%{env:d}.%{app:d}.com'
160
+
157
161
  # E-mail subject, here: "User texter: Welcome"
158
162
  config.textris_mail_subject_template = '%{texter:dh} texter: %{action:h}'
159
163
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Słuszniak
@@ -14,30 +14,44 @@ dependencies:
14
14
  name: render_anywhere
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.10
19
+ version: '0.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.10
26
+ version: '0.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionmailer
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: twilio-ruby
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
41
55
  description: Implement texter classes for sending SMS messages in similar way to how
42
56
  e-mails are sent with ActionMailer-based mailers. Take advantage of e-mail proxying
43
57
  and enhanced phone number parsing, among others.