Sha256: 1b5ed5658c25c3a0e14c94c98b98fa101d0c4df2a45ed49f465ac55c93054793

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

# External requires.
require 'json'
require 'rest-client'
require 'hashie'
require 'logger'
require 'openssl'

# Internal requires.
require 'facebook_ads/base'
Dir[File.expand_path('../facebook_ads/*.rb', __FILE__)].each { |f| require f }

# The primary namespace for this gem.
module FacebookAds
  def self.logger=(logger)
    @logger = logger
  end

  def self.logger
    unless defined?(@logger)
      @logger       = Logger.new('/dev/null')
      @logger.level = Logger::Severity::UNKNOWN
    end

    @logger
  end

  def self.base_uri=(base_uri)
    @base_uri = base_uri
  end

  def self.base_uri
    @base_uri = "https://graph.facebook.com/v#{api_version}" unless defined?(@base_uri)
    @base_uri
  end

  def self.api_version=(api_version)
    @api_version = api_version
  end

  def self.api_version
    @api_version = '2.9' unless defined?(@api_version)
    @api_version
  end

  def self.access_token=(access_token)
    @access_token = access_token
  end

  def self.access_token
    @access_token
  end

  def self.app_secret=(app_secret)
    @app_secret = app_secret
  end

  def self.app_secret
    @app_secret
  end

  def self.appsecret_proof
    OpenSSL::HMAC.hexdigest(
      OpenSSL::Digest.new('sha256'),
      @app_secret,
      @access_token
    )
  end

  def self.business_id=(business_id)
    @business_id = business_id
  end

  def self.business_id
    @business_id
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facebook_ads-0.6.3 lib/facebook_ads.rb
facebook_ads-0.6.2 lib/facebook_ads.rb
facebook_ads-0.6.0 lib/facebook_ads.rb
facebook_ads-0.5.1 lib/facebook_ads.rb
facebook_ads-0.5 lib/facebook_ads.rb