Module: CodePicnic

Defined in:
lib/codepicnic.rb,
lib/codepicnic/token.rb,
lib/codepicnic/version.rb,
lib/codepicnic/request.rb,
lib/codepicnic/console.rb,
lib/codepicnic/api_request.rb

Defined Under Namespace

Modules: APIRequest Classes: Console, Request, Token

Constant Summary collapse

VERSION =
"0.1.10"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.client_idObject

Returns the value of attribute client_id


12
13
14
# File 'lib/codepicnic.rb', line 12

def client_id
  @client_id
end

.client_secretObject

Returns the value of attribute client_secret


12
13
14
# File 'lib/codepicnic.rb', line 12

def client_secret
  @client_secret
end

Class Method Details

.get_tokenObject


24
25
26
# File 'lib/codepicnic.rb', line 24

def get_token
  Token.new(@client_id, @client_secret)
end

.refresh_tokenObject


20
21
22
# File 'lib/codepicnic.rb', line 20

def refresh_token
  @token_client = get_token
end

.tokenObject


14
15
16
17
18
# File 'lib/codepicnic.rb', line 14

def token
  @token_client ||= get_token
  refresh_token if @token_client.expired?
  @token_client.access_token
end