Class: OAuthTest

Inherits:
Object
  • Object
show all
Defined in:
lib/oa_test/oa_test.rb,
lib/oa_test/oa_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ks) ⇒ OAuthTest

Returns a new instance of OAuthTest.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/oa_test/oa_test.rb', line 9

def initialize(ks)
  config_load(ks)
  @key    = config.key
  @secret = config.secret
  @return = config.return 
  @host   = config.host   
  @api    = config.api    
  @typ    = {
   :json => {"Accept" => "application/json", "Content-Type" => "application/json"},
   :xml  => {"Accept" => "application/xml", "Content-Type" => "application/xml"},
  }
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



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

def api
  @api
end

#configObject (readonly)

Returns the value of attribute config.



18
19
20
# File 'lib/oa_test/oa_config.rb', line 18

def config
  @config
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#respObject (readonly)

Returns the value of attribute resp.



7
8
9
# File 'lib/oa_test/oa_test.rb', line 7

def resp
  @resp
end

Instance Method Details

#delete(path) ⇒ Object



38
39
40
# File 'lib/oa_test/oa_test.rb', line 38

def delete(path)
  rtn @access_token.delete(@host+@api+path,typ(path))
end

#get(path) ⇒ Object



26
27
28
# File 'lib/oa_test/oa_test.rb', line 26

def get(path)
  rtn @access_token.get(@host+@api+path,typ(path))
end

#post(path, params) ⇒ Object



30
31
32
# File 'lib/oa_test/oa_test.rb', line 30

def post(path,params)
  rtn @access_token.post(@host+@api+path,params.to_json,typ(path))
end

#put(path, params) ⇒ Object



34
35
36
# File 'lib/oa_test/oa_test.rb', line 34

def put(path,params)
  rtn @access_token.put(@host+@api+path,params.to_json,typ(path))
end

#yauth(lp) ⇒ Object



22
23
24
# File 'lib/oa_test/oa_test.rb', line 22

def yauth(lp)
  get_part(lp).get_token()
end