Module: Googl::OAuth2::Utils
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#items ⇒ Object
Returns the value of attribute items.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
Instance Method Summary collapse
- #authorized? ⇒ Boolean
- #expires? ⇒ Boolean
-
#history(options = {}) ⇒ Object
Gets a user's history of shortened URLs.
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def access_token @access_token end |
#client_id ⇒ Object
Returns the value of attribute client_id.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def client_secret @client_secret end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def expires_at @expires_at end |
#expires_in ⇒ Object
Returns the value of attribute expires_in.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def expires_in @expires_in end |
#items ⇒ Object
Returns the value of attribute items.
7 8 9 |
# File 'lib/googl/oauth2/utils.rb', line 7 def items @items end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
6 7 8 |
# File 'lib/googl/oauth2/utils.rb', line 6 def refresh_token @refresh_token end |
Instance Method Details
#authorized? ⇒ Boolean
13 14 15 |
# File 'lib/googl/oauth2/utils.rb', line 13 def !access_token.nil? && !refresh_token.nil? && !expires_in.nil? && !expires_at.nil? end |
#expires? ⇒ Boolean
9 10 11 |
# File 'lib/googl/oauth2/utils.rb', line 9 def expires? expires_at < Time.now end |
#history(options = {}) ⇒ Object
Gets a user's history of shortened URLs.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/googl/oauth2/utils.rb', line 19 def history(={}) return unless resp = (.nil? || .empty?) ? get(Googl::Utils::API_HISTORY_URL) : get(Googl::Utils::API_HISTORY_URL, :query => ) case resp.code when 200 self.items = resp.parsed_response.to_openstruct else raise exception("#{resp.code} #{resp.parsed_response}") end end |