Class: Gapi::OauthMiddle

Inherits:
Object
  • Object
show all
Defined in:
lib/gapi/oauth_middle.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ OauthMiddle

the ruby-oauth gem access_token



6
7
8
# File 'lib/gapi/oauth_middle.rb', line 6

def initialize( access_token )
  @access_token = access_token
end

Instance Method Details

#get(domain, path, opts) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/gapi/oauth_middle.rb', line 10

def get( domain, path, opts )
  data = opts.collect {|kv| kv.join('=') }.join('&')
  path = "#{path}?#{data}" if data && data.length > 0
  resp, data = @access_token.get( path, {} )
  code = resp.code.to_i
  body = resp.body
  return code, body
end