Class: Cloudkick::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudkick/base.rb

Direct Known Subclasses

Node, Nodes

Instance Method Summary collapse

Constructor Details

#initialize(consumer_key, consumer_secret) ⇒ Base

Returns a new instance of Base.



28
29
30
31
# File 'lib/cloudkick/base.rb', line 28

def initialize(consumer_key, consumer_secret)
  @@key = consumer_key
  @@secret = consumer_secret
end

Instance Method Details

#access_tokenObject



39
40
41
# File 'lib/cloudkick/base.rb', line 39

def access_token
  @@access_token ||= OAuth::AccessToken.new(consumer)
end

#consumerObject



33
34
35
36
37
# File 'lib/cloudkick/base.rb', line 33

def consumer
  @@consumer ||= OAuth::Consumer.new(@@key, @@secret,
                                    :site => 'https://api.cloudkick.com',
                                    :http_method => :get)
end

#get(type, query = nil) ⇒ Object



43
44
45
46
47
# File 'lib/cloudkick/base.rb', line 43

def get(type, query=nil)
  if type == 'nodes'
    Cloudkick::Nodes.new(query)
  end
end