lib/soaspec/exchange_handlers/rest_accessors.rb in soaspec-0.1.11 vs lib/soaspec/exchange_handlers/rest_accessors.rb in soaspec-0.1.12

- old
+ new

@@ -11,16 +11,21 @@ end # Will create access_token method based on passed parameters # @param [Hash] params Params client_id: nil, client_secret: nil, token_url: nil, username: nil, password: nil, security_token: nil def oauth2(params) + # Object to handle oauth2 + define_method('oauth_obj') do + OAuth2.new(params, api_username) + end + # Method to send request to get oauth token based on parameters define_method('oauth_response') do - OAuth2.new(params, api_username).response + oauth_obj.response end define_method('access_token') do - oauth_response['access_token'] + oauth_obj.access_token end define_method('instance_url') do oauth_response['instance_url'] end \ No newline at end of file