Skip to content

Commit

Permalink
handle nil expires in
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre LeBlanc committed Jun 7, 2019
1 parent 5adb143 commit f790920
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion help_scout-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.email = ['[email protected]']

spec.summary = 'Ruby Help Scout SDK'
spec.description = 'Ruby Help Scout (aka HelpScout) SDK.'
spec.description = 'Ruby Help Scout (aka HelpScout) SDK, using Mailbox API v2.0'
spec.homepage = 'https://github.com/taxjar/help_scout-sdk'
spec.license = 'MIT'

Expand Down
9 changes: 4 additions & 5 deletions lib/help_scout/api/access_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ def token_request_params
end

attr_accessor :invalid
attr_reader :expires_in, :value
attr_reader :expires_at, :expires_in, :value

def initialize(params)
@value = params[:access_token]
@expires_in = params[:expires_in]
end

def expires_at
@_expires_at ||= Time.now.utc + expires_in
return unless @expires_in
@expires_at = Time.now.utc + expires_in
end

def expired?
return false unless expires_at
Time.now.utc > expires_at
end

Expand Down
2 changes: 1 addition & 1 deletion lib/help_scout/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module HelpScout
VERSION = '1.0.1'
VERSION = '1.0.2'
end

0 comments on commit f790920

Please sign in to comment.