Class: Rack::OAuth2::AccessToken::Introspectable::Result

Inherits:
FbGraph::Node
  • Object
show all
Defined in:
lib/patch/rack/oauth2/access_token/introspectable.rb

Constant Summary collapse

ATTRIBUTES =
[:application, :user, :expires_at, :issued_at, :is_valid, :metadata, :scopes, :error]

Instance Attribute Summary

Attributes inherited from FbGraph::Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods inherited from FbGraph::Node

#connection, #destroy, fetch, #fetch, #update

Methods included from FbGraph::Comparison

#==

Constructor Details

#initialize(identifier = nil, attributes = {}) ⇒ Result

Returns a new instance of Result.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/patch/rack/oauth2/access_token/introspectable.rb', line 9

def initialize(identifier = nil, attributes = {})
  super :debug_token, attributes
  if (data = attributes[:data])
    @application = FbGraph::Application.new data[:app_id], :name => data[:application]
    @user        = FbGraph::User.new data[:user_id]
    @expires_at  = Time.at data[:expires_at]
    @issued_at   = Time.at data[:issued_at] if data[:issued_at]
    (ATTRIBUTES - [:application, :user, :expires_at, :issued_at]).each do |key|
      self.send :"#{key}=", data[key]
    end
  end
end