Module: TropoREST

Defined in:
lib/tropo-rest.rb,
lib/tropo-rest/cli.rb,
lib/tropo-rest/version.rb

Defined Under Namespace

Classes: API, CLI, Troplets

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.logger=(logger) ⇒ Object



5
6
7
8
9
# File 'lib/tropo-rest.rb', line 5

def logger=(logger)
  [API, Troplets].each do |endpoint|
    endpoint.send :logger=, logger
  end
end

.method_missing(method_name, *args, &block) ⇒ Object



24
25
26
# File 'lib/tropo-rest.rb', line 24

def method_missing(method_name, *args, &block)
  API.send method_name, *args, &block
end

.tokens=(tokens) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tropo-rest.rb', line 11

def tokens=(tokens)
  [[:tropo, API], [:troplets, Troplets]].each do |type, target|
    if token = tokens[type]
      if token.is_a? String
        target.voice_token = token
      elsif token.is_a? Hash
        target.voice_token = token[:voice]
        target.messaging_token = token[:messaging]
      end
    end
  end
end