Class: Facemock::FbGraph::Application
- Inherits:
-
Object
- Object
- Facemock::FbGraph::Application
- Defined in:
- lib/facemock/fb_graph/application.rb,
lib/facemock/fb_graph/application/user.rb,
lib/facemock/fb_graph/application/test_users.rb,
lib/facemock/fb_graph/application/user/permission.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#access_token ⇒ Object
user access token.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(identifier, options = {}) ⇒ Application
constructor
A new instance of Application.
- #test_user!(options = {}) ⇒ Object
- #test_users(options = {}) ⇒ Object
Constructor Details
#initialize(identifier, options = {}) ⇒ Application
Returns a new instance of Application.
14 15 16 17 18 19 |
# File 'lib/facemock/fb_graph/application.rb', line 14 def initialize(identifier, ={}) opts = Hashie::Mash.new() @identifier = identifier @secret = opts.secret @access_token = opts.access_token end |
Instance Attribute Details
#access_token ⇒ Object
user access token
12 13 14 |
# File 'lib/facemock/fb_graph/application.rb', line 12 def access_token @access_token end |
#identifier ⇒ Object
Returns the value of attribute identifier.
10 11 12 |
# File 'lib/facemock/fb_graph/application.rb', line 10 def identifier @identifier end |
#secret ⇒ Object
Returns the value of attribute secret.
11 12 13 |
# File 'lib/facemock/fb_graph/application.rb', line 11 def secret @secret end |
Instance Method Details
#fetch ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/facemock/fb_graph/application.rb', line 21 def fetch @record = if @identifier == :app unless validate_access_token raise Facemock::FbGraph::InvalidToken.new "Invalid OAuth access token." end find_by_access_token else if @access_token && !validate_access_token raise Facemock::FbGraph::InvalidToken.new "Invalid OAuth access token." elsif !validate_identifier_and_secret raise Facemock::FbGraph::InvalidRequest.new "Unsupported get request." end Facemock::Database::Application.find_by_id(@identifier) end if @record @identifier = @record.id @secret = @record.secret @access_token = nil end self end |