Sha256: 1491184485604b011bc219f85b8e4f67d34fd87fe4658770b98359e11c6b63b9

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'facemock/version'
require 'facemock/config'
require 'facemock/fb_graph'
require 'facemock/database'
require 'facemock/errors'
require 'facemock/auth_hash'
require 'facemock/application'
require 'facemock/user'
require 'facemock/permission'
require 'facemock/authorization_code'

module Facemock 
  extend self

  def on
    Facemock::FbGraph.on
  end

  def off
    Facemock::FbGraph.off
  end

  def on?
    FbGraph == Facemock::FbGraph
  end

  def auth_hash(access_token=nil)
    if access_token.kind_of?(String) && access_token.size > 0
      user = Facemock::User.find_by_access_token(access_token)
      if user
        Facemock::AuthHash.new({
          provider:    "facebook",
          uid:         user.id,
          info:        { name:     user.name },
          credentials: { token:    access_token, expires_at: Time.now + 60.days },
          extra:       { raw_info: { id: user.id, name: user.name } }
        })
      else
        Facemock::AuthHash.new
      end
    else
      Facemock::AuthHash.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facemock-0.0.11 lib/facemock.rb
facemock-0.0.10 lib/facemock.rb
facemock-0.0.9 lib/facemock.rb
facemock-0.0.8 lib/facemock.rb