Class: InvisibleCollector::Voice
- Inherits:
-
Object
- Object
- InvisibleCollector::Voice
- Defined in:
- lib/invisible_collector/voice.rb
Constant Summary collapse
- VOICE_API =
'https://voice.invisiblecollector.com'
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
Instance Method Summary collapse
- #connection ⇒ Object
- #email(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Voice
constructor
A new instance of Voice.
- #resources ⇒ Object
- #sms(options = {}) ⇒ Object
- #vms(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Voice
Returns a new instance of Voice.
11 12 13 14 |
# File 'lib/invisible_collector/voice.rb', line 11 def initialize( = {}) @api_token = .with_indifferent_access[:api_token] @host = .with_indifferent_access[:host] end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
9 10 11 |
# File 'lib/invisible_collector/voice.rb', line 9 def api_token @api_token end |
Instance Method Details
#connection ⇒ Object
16 17 18 19 20 |
# File 'lib/invisible_collector/voice.rb', line 16 def connection @connection ||= Faraday.new do |req| req.adapter :net_http end end |
#email(options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/invisible_collector/voice.rb', line 22 def email( = {}) resources[:alarm] ||= Resources::EmailResource.new({ connection: connection }.merge()) resources[:alarm] end |
#resources ⇒ Object
37 38 39 |
# File 'lib/invisible_collector/voice.rb', line 37 def resources @resources ||= {} end |
#sms(options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/invisible_collector/voice.rb', line 27 def sms( = {}) resources[:alarm] ||= Resources::SmsResource.new({ connection: connection }.merge()) resources[:alarm] end |
#vms(options = {}) ⇒ Object
32 33 34 35 |
# File 'lib/invisible_collector/voice.rb', line 32 def vms( = {}) resources[:alarm] ||= Resources::VmsResource.new({ connection: connection }.merge()) resources[:alarm] end |