Class: Viaduct::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/viaduct/api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = nil, secret = nil) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/viaduct/api/client.rb', line 11

def initialize(token = nil, secret = nil)
  @token, @secret = token, secret
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, value = nil) ⇒ Object



35
36
37
# File 'lib/viaduct/api/client.rb', line 35

def method_missing(name, value = nil)
  value.nil? ? controller(name) : super
end

Instance Attribute Details

#secretObject (readonly)

Returns the value of attribute secret.



9
10
11
# File 'lib/viaduct/api/client.rb', line 9

def secret
  @secret
end

#tokenObject (readonly)

Returns the value of attribute token.



8
9
10
# File 'lib/viaduct/api/client.rb', line 8

def token
  @token
end

Instance Method Details

#controller(*args) ⇒ Object



19
20
21
# File 'lib/viaduct/api/client.rb', line 19

def controller(*args)
  moonrope.controller(*args)
end

#pushObject



23
24
25
# File 'lib/viaduct/api/client.rb', line 23

def push
  @push_client ||= PushClient.new(self)
end

#request(*args) ⇒ Object



15
16
17
# File 'lib/viaduct/api/client.rb', line 15

def request(*args)
  moonrope.request(*args)
end