class Cronofy::Credentials

Attributes

access_token[R]
account_id[R]
application_calendar_id[R]
expires_at[R]
expires_in[R]
linking_profile[R]
refresh_token[R]
scope[R]
sub[R]

Public Class Methods

new(oauth_token) click to toggle source
# File lib/cronofy/types.rb, line 46
def initialize(oauth_token)
  @access_token = oauth_token.token
  @account_id = oauth_token.params['account_id']
  @application_calendar_id = oauth_token.params['application_calendar_id']
  @sub = oauth_token.params['sub']
  @expires_at = oauth_token.expires_at
  @expires_in = oauth_token.expires_in
  @refresh_token = oauth_token.refresh_token
  @scope = oauth_token.params['scope']

  if details = oauth_token.params['linking_profile']
    @linking_profile = LinkingProfile.new(details)
  end
end

Public Instance Methods

to_h() click to toggle source
# File lib/cronofy/types.rb, line 61
def to_h
  hash = {
    access_token: access_token,
    expires_at: expires_at,
    expires_in: expires_in,
    refresh_token: refresh_token,
    scope: scope,
  }

  if account_id
    hash[:account_id] = account_id
  end

  if application_calendar_id
    hash[:application_calendar_id] = application_calendar_id
  end

  if sub
    hash[:sub] = sub
  end

  if linking_profile
    hash[:linking_profile] = linking_profile.to_h
  end

  hash
end
to_hash() click to toggle source
# File lib/cronofy/types.rb, line 89
def to_hash
  warn "#to_hash has been deprecated, use #to_h instead"
  to_h
end