Class: DssReuters::Session
- Inherits:
-
Object
- Object
- DssReuters::Session
- Includes:
- HTTParty
- Defined in:
- lib/dss_reuters.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize ⇒ Session
constructor
A new instance of Session.
Constructor Details
#initialize ⇒ Session
Returns a new instance of Session.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dss_reuters.rb', line 20 def initialize @logger = ::Logger.new(STDOUT) @logger.level = Config::LOG_LEVEL login_path = "/RestApi/v1/Authentication/RequestToken" = { headers: { "Prefer" => "respond-async", "Content-Type" => "application/json; odata=minimalmetadata" }, body: { "Credentials" =>{ "Username" => Config::DSS_USERNAME, "Password" => Config::DSS_PASSWORD } }.to_json } resp = self.class.post login_path, @token = resp["value"] @context = resp["@odata.context"] @logger.debug resp end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
18 19 20 |
# File 'lib/dss_reuters.rb', line 18 def context @context end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
18 19 20 |
# File 'lib/dss_reuters.rb', line 18 def logger @logger end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
18 19 20 |
# File 'lib/dss_reuters.rb', line 18 def token @token end |