README.md in cellular-1.3.0 vs README.md in cellular-2.0.0
- old
+ new
@@ -40,11 +40,14 @@
config.sender = 'Default custom sender'
config.country_code = 'NO'
end
```
+Cellular uses Rails' [ActiveJob](http://edgeguides.rubyonrails.org/active_job_basics.html)
+interface to interact with queue backends. Read appropriate documentation to set up queue.
+
### Available Backends
* [CoolSMS](http://coolsms.com/)
* [Sendega](http://sendega.com/)
* Log (logs to `$stdout`)
@@ -64,30 +67,60 @@
country_code: 'NO' # defaults to Cellular.config.country_code
)
sms.deliver
```
+For use with multiple recipients in one request use:
-You can also use Sidekiq to send texts, which is great if you're in a Rails app
-and are concerned that it might time out or something. Actually, if you have
-Sidekiq at your disposal, it's a great idea anyway! To use it, just call
-`deliver_later` instead of `deliver` on the SMS object:
+```ruby
+sms = Cellular::SMS.new(
+ recipients: ['47xxxxxxx1','47xxxxxxx2','47xxxxxxx3'],
+ sender: 'Custom sender',
+ message: 'This is an SMS message',
+ price: 0,
+ country_code: 'NO' # defaults to Cellular.config.country_code
+)
+sms.deliver
+```
+
+
+#### Delayed SMSs delivery
+
+You can also send texts asynchronously, which is great if you're in a Rails app
+and are concerned that it might time out or something. To use it, just call
+`deliver_async` instead of `deliver` on the SMS object:
+
```ruby
sms = Cellular::SMS.new(
recipient: '47xxxxxxxx',
sender: 'Custom sender',
message: 'This is an SMS message'
)
-sms.deliver_later
+sms.deliver_async
```
-This will create a Sidekiq job for you on the **cellular** queue, so make sure
-that Sidekiq is processing that queue.
+This will create a delayed job for you on the **cellular** queue, so make sure
+that your queue processor is running.
-[sidekiq]: http://sidekiq.org
+To override queue name, use **queue** option
+```ruby
+sms.deliver_async(queue: :urgent)
+```
+Using ActiveJob, Cellular allows you to schedule the time when an SMS will be sent.
+Just call `deliver_async(wait_until: timestamp)` or `deliver_async(wait: time)` on the SMS object:
+
+```ruby
+sms = Cellular::SMS.new(
+ recipient: '47xxxxxxxx',
+ sender: 'Custom sender',
+ message: 'This is an SMS message'
+)
+
+sms.deliver_async(wait_until: Date.tomorrow.noon)
+```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)