Sha256: c415239dfd164268c95c4a6b228b057b7b49578c2cd74d559387b4376955076d

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

module FbGraph
  class Application < Node
    include Connections::Insights

    attr_accessor :name, :description, :category, :subcategory, :link, :secret

    def initialize(client_id, options = {})
      super
      @name        = options[:name]
      @description = options[:description]
      @category    = options[:category]
      @subcategory = options[:subcategory]
      @link        = options[:link]
      @secret      = options[:secret]
    end

    def get_access_token(secret = nil)
      self.secret ||= secret
      auth = FbGraph::Auth.new(self.identifier, self.secret)
      response_string = auth.client.request(:post, auth.client.access_token_url, {
        :client_id => self.identifier,
        :client_secret => self.secret,
        :type => 'client_cred'
      })
      self.access_token = response_string.split('=').last
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-0.7.0 lib/fb_graph/application.rb