class HelpDeskAPI::Authentication::Data
Attributes
authenticity_token[RW]
csrf_token[RW]
password[RW]
username[RW]
Public Class Methods
new()
click to toggle source
# File lib/helpdeskapi/authentication.rb, line 18 def initialize @username = nil @password = nil @authenticity_token = nil @csrf_token = nil @cookies = nil @organization_id = nil @creator_id = nil end
Public Instance Methods
creator_id()
click to toggle source
Returns creator_id
for current user from users endpoint
# File lib/helpdeskapi/authentication.rb, line 33 def creator_id return @creator_id if @creator_id HelpDeskAPI::Users.users.each do |user| if user.email == @username @creator_id = user.id return @creator_id end end fail NoCreatorIdError, "Failed to find creator_id for user: #{@username}" end
organization_id()
click to toggle source
Returns organization_id
or contacts API to get id of first organization.
# File lib/helpdeskapi/authentication.rb, line 48 def organization_id return @organization_id if @organization_id @organization_id = HelpDeskAPI::Organizations.organizations.first.id end
signed_in?()
click to toggle source
# File lib/helpdeskapi/authentication.rb, line 28 def signed_in? return !@cookies.nil? end