Module: Siamese
- Defined in:
- lib/siamese.rb,
lib/siamese/message.rb,
lib/siamese/version.rb
Defined Under Namespace
Classes: Message
Constant Summary collapse
- VERSION =
"0.1.2"
Class Method Summary collapse
- .client ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .deliver(attributes) ⇒ Object
- .method_missing(meth, *args, **kwargs, &block) ⇒ Object
Class Method Details
.client ⇒ Object
35 36 37 |
# File 'lib/siamese.rb', line 35 def client @client ||= Twilio::REST::Client.new(twilio_account_sid, twilio_auth_token) end |
.configure {|_self| ... } ⇒ Object
10 11 12 |
# File 'lib/siamese.rb', line 10 def configure yield self end |
.deliver(attributes) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/siamese.rb', line 25 def deliver attributes deliveries << attributes if Rails.env.production? while deliveries.any? attributes = deliveries.pop client.api.account..create(**attributes) end end end |
.method_missing(meth, *args, **kwargs, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/siamese.rb', line 14 def method_missing meth, *args, **kwargs, &block template = "sms/#{meth}" if ApplicationController.new.lookup_context.exists?(template) context = args.first = args.second || {} Message.new(template, context, ) else super end end |