Class: NightcrawlerSwift::Connection
- Inherits:
-
Object
- Object
- NightcrawlerSwift::Connection
- Defined in:
- lib/nightcrawler_swift/connection.rb
Instance Attribute Summary collapse
- #auth_response ⇒ Object
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#token_id ⇒ Object
readonly
Returns the value of attribute token_id.
Instance Method Summary collapse
Instance Attribute Details
#auth_response ⇒ Object
18 19 20 21 22 |
# File 'lib/nightcrawler_swift/connection.rb', line 18 def auth_response @auth_response ||= nil authenticate! if @auth_response.nil? @auth_response end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
15 16 17 |
# File 'lib/nightcrawler_swift/connection.rb', line 15 def expires_at @expires_at end |
#token_id ⇒ Object (readonly)
Returns the value of attribute token_id.
15 16 17 |
# File 'lib/nightcrawler_swift/connection.rb', line 15 def token_id @token_id end |
Instance Method Details
#configure ⇒ Object
36 37 38 39 40 41 |
# File 'lib/nightcrawler_swift/connection.rb', line 36 def configure select_token select_catalog select_endpoints configure_urls end |
#connect! ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/nightcrawler_swift/connection.rb', line 24 def connect! authenticate! configure NightcrawlerSwift.logger.debug "[NightcrawlerSwift] Connected, token_id: #{token_id}" self end |
#connected? ⇒ Boolean
32 33 34 |
# File 'lib/nightcrawler_swift/connection.rb', line 32 def connected? !self.token_id.nil? and self.expires_at > Time.now end |