Class: NightcrawlerSwift::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/nightcrawler_swift/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_responseObject



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_atObject (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_idObject (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

#configureObject



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

Returns:

  • (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