Class: Vimeo::Advanced::Base

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/vimeo/advanced/base.rb

Direct Known Subclasses

Auth, Contact, Group, Person, Test, Upload, Video

Instance Method Summary collapse

Constructor Details

#initialize(api_key, secret, format_options = {}) ⇒ Base

TODO: Pass an auth token, if you’ve already got one TODO: implement format_options Requires your API key and secret phrase. The API key and secret are prepended to every request.



12
13
14
15
# File 'lib/vimeo/advanced/base.rb', line 12

def initialize(api_key, secret, format_options={})
  @auth = { :api_key => api_key }
  @secret = secret
end

Instance Method Details

Generates a link that allows a user to authorize your web application to use the advanced API



19
20
21
22
# File 'lib/vimeo/advanced/base.rb', line 19

def (perms, frob)
  api_sig = generate_api_sig :perms => perms
  "http://vimeo.com/services/auth/?api_key=#{@auth[:api_key]}&perms=#{perms}&frob=#{frob}&api_sig=#{api_sig}"
end

#upload_sig(ticket_id, auth_token) ⇒ Object

Generates the proper API signature for a file upload.



27
28
29
30
31
32
33
34
# File 'lib/vimeo/advanced/base.rb', line 27

def upload_sig(ticket_id, auth_token)
  sig_options = {
    :ticket_id => ticket_id,
    :auth_token => auth_token
  }

  generate_api_sig sig_options
end