Module: HighwindsAPI

Defined in:
lib/highwinds-api.rb,
lib/highwinds-api/content.rb

Defined Under Namespace

Classes: Content

Constant Summary collapse

ONE_HOUR_IN_SECONDS =
3600

Class Method Summary collapse

Class Method Details

.clear_tokenObject

should be used only in testing scenarios



27
28
29
30
# File 'lib/highwinds-api.rb', line 27

def self.clear_token
  @token = nil
  @token_time = nil
end

.credentialsObject



6
7
8
9
10
11
# File 'lib/highwinds-api.rb', line 6

def self.credentials
  {
    username: @username,
    password: @password
  }
end

.get_tokenObject



18
19
20
21
22
23
24
# File 'lib/highwinds-api.rb', line 18

def self.get_token
  unless (@token_time and Time.now - @token_time < ONE_HOUR_IN_SECONDS)
    @token = Content::get_token
    @token_time = Time.now
  end
  @token
end

.set_credentials(username, password) ⇒ Object



13
14
15
16
# File 'lib/highwinds-api.rb', line 13

def self.set_credentials(username, password)
    @username = username
    @password = password
end