text_message_rails 0.1.0 → 0.1.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: 26a5894e66db8b6c2e44ed920d7acf88ceb77531
4
- data.tar.gz: 8ebc8940b11eb126ea840c227b0f121fbd675230
3
+ metadata.gz: 7ed8db9bab0015b9afb253c1c295348b76fcfd14
4
+ data.tar.gz: c0707f4cc5528b0ed36f942f0fb98ce14ec1f767
5
5
  SHA512:
6
- metadata.gz: ef033256a2d69cf276bc05a7efedde046a4854750f1035924fd84ebc48c722594c43c60f18cfb07447bc6982c7e520df9b73801878263c3d8655ad9f31536949
7
- data.tar.gz: 53f212e246d673a905f3e06b309e7a6b321a173f3718557a17c1727b45730945f75d6b47f8dc7a78c43507b0c7b54c86927c267da566268823334f4428e2c257
6
+ metadata.gz: 5f386a532342730dc6372235cfa660c2d4d096b15719ab193126f1d0f80bef1f2735661cc372ac1b963370fd23d35cb8c9113050c4d86fa88be1a5d56119c5ac
7
+ data.tar.gz: 29d47f73dcef3bf0115c281288d0ed9ab0fd47a8ecfdef9fdf3d97e2884ace798a6bc0535b0dba32ec50836034f13de4d4dfbd6c1263e34b24bf4e6633879f19
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .DS_Store
11
+ *.gem
data/README.md CHANGED
@@ -65,6 +65,8 @@ ClientTextMessages.confirm_order(order).deliver_later!
65
65
 
66
66
  For the time being, only the `TextMagic` provider is supported.
67
67
 
68
+ ### TextMagic
69
+
68
70
  To use it, include it in you `Gemfile`:
69
71
 
70
72
  ```ruby
@@ -76,12 +78,19 @@ gem "text_magic"
76
78
  gem "phony_rails"
77
79
  ```
78
80
 
79
- And enable its use in the configuration:
81
+ Enable its use in the configuration:
80
82
 
81
83
  ```ruby
82
84
  config.text_message.provider = :text_magic
83
85
  ```
84
86
 
87
+ And provision the following environment variables:
88
+
89
+ ```yaml
90
+ TEXTMAGIC_USERNAME: "my textmagic user name"
91
+ TEXTMAGIC_PASSWORD: "my textmagic password"
92
+ ```
93
+
85
94
  ## Development
86
95
 
87
96
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -3,6 +3,7 @@ module TextMessage
3
3
 
4
4
  class TextMagic < Base
5
5
  def deliver_text_message
6
+ logger.debug "Delivering message to #{escaped_recipients.join(', ')}"
6
7
  client.send(message, *escaped_recipients, options)
7
8
  end
8
9
 
@@ -24,12 +24,14 @@ module TextMessage
24
24
  end
25
25
 
26
26
  def message
27
- delivery.body.to_str
27
+ delivery.body.to_s
28
28
  end
29
29
 
30
30
  def recipients
31
- delivery.recipients.map(&:to_str)
31
+ delivery.recipients.map(&:to_s)
32
32
  end
33
+
34
+ delegate :logger, to: Rails
33
35
  end
34
36
 
35
37
  # Known providers
@@ -5,12 +5,14 @@ module TextMessage
5
5
  config.text_message = ActiveSupport::OrderedOptions.new
6
6
 
7
7
  initializer "text_message.configure" do |app|
8
- app_options = app.config.text_message
8
+ # Update load paths
9
+ app.config.paths.add "app/text_messages", eager_load: true
9
10
 
11
+ # Load plugin-specific options
12
+ app_options = app.config.text_message
10
13
  if default_url_options = app_options.default_url_options
11
14
  TextMessage::Controller.default_url_options = default_url_options
12
15
  end
13
-
14
16
  if provider_key = app_options.provider
15
17
  TextMessage::Controller.provider = TextMessage::Providers.find(provider_key)
16
18
  end
@@ -1,3 +1,3 @@
1
1
  module TextMessage
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_message_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurélien Noce