Class: Vimeo::Advanced::Base

Inherits:
Object
  • Object
show all
Extended by:
CreateApiMethod
Defined in:
lib/vimeo/advanced/base.rb

Constant Summary collapse

ENDPOINT =
"http://vimeo.com/api/rest/v2"

Instance Method Summary collapse

Methods included from CreateApiMethod

create_api_method

Constructor Details

#initialize(consumer_key, consumer_secret, options = {}) ⇒ Base

Returns a new instance of Base.



72
73
74
75
76
77
# File 'lib/vimeo/advanced/base.rb', line 72

def initialize(consumer_key, consumer_secret, options = {})
  @oauth_consumer = OAuth::Consumer.new(consumer_key, consumer_secret, :site => 'http://vimeo.com', :http_method => :get, :scheme => :header)
  unless options[:token].nil? && options[:secret].nil?
    @access_token = OAuth::AccessToken.new(@oauth_consumer, options[:token], options[:secret])
  end
end

Instance Method Details

#authorize_url(permission = "delete") ⇒ Object



79
80
81
# File 'lib/vimeo/advanced/base.rb', line 79

def authorize_url(permission = "delete")
  get_request_token.authorize_url :permission => permission
end

#get_access_token(oauth_token = nil, oauth_secret = nil, oauth_verifier = nil) ⇒ Object



87
88
89
# File 'lib/vimeo/advanced/base.rb', line 87

def get_access_token(oauth_token=nil, oauth_secret=nil, oauth_verifier=nil)
  @access_token ||= OAuth::RequestToken.new(@oauth_consumer, oauth_token, oauth_secret).get_access_token :oauth_verifier => oauth_verifier
end

#get_request_tokenObject



83
84
85
# File 'lib/vimeo/advanced/base.rb', line 83

def get_request_token
  @request_token ||= @oauth_consumer.get_request_token :scheme => :header
end