Class: PersonalityInsights::ActiveMethod::Base

Inherits:
Extra
  • Object
show all
Includes:
Generator::PersonalityRequest
Defined in:
lib/watson-personality-insights/active_method/base.rb

Direct Known Subclasses

Profile

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Generator::PersonalityRequest

#base_url_request, #create_request, #json_parser, #response, #uri_request_api

Methods inherited from Extra

add_response_field, #result

Constructor Details

#initialize(file) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/watson-personality-insights/active_method/base.rb', line 7

def initialize(file)
  @file = file
  @username = PersonalityInsights.username
  @password = PersonalityInsights.password
end

Instance Attribute Details

#acceptObject

Returns the value of attribute accept.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def accept
  @accept
end

#accept_languageObject

Returns the value of attribute accept_language.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def accept_language
  @accept_language
end

#content_languageObject

Returns the value of attribute content_language.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def content_language
  @content_language
end

#fileObject

Returns the value of attribute file.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def file
  @file
end

#json_resultObject

Returns the value of attribute json_result.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def json_result
  @json_result
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def options
  @options
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def password
  @password
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/watson-personality-insights/active_method/base.rb', line 5

def username
  @username
end

Instance Method Details

#get_profile(options = {}) ⇒ Object



13
14
15
16
# File 'lib/watson-personality-insights/active_method/base.rb', line 13

def get_profile(options={})
  @options = options
  @json_result = request
end

#params_addressableObject



22
23
24
25
26
# File 'lib/watson-personality-insights/active_method/base.rb', line 22

def params_addressable
  uri = Addressable::URI.new
  uri.query_values = @options
  uri.query
end

#requestObject



18
19
20
# File 'lib/watson-personality-insights/active_method/base.rb', line 18

def request
  json_parser(endpoint)
end