Sha256: ed97c86d6191a29cb14c82ecb27ea6cb92c11f09ba625bb3b944de1dc78d8b50

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'active_support/core_ext/object/try'
require 'vk/exceptions'
require 'vk/version'

module Vk
  autoload :Client, 'vk/client'
  autoload :DSL, 'vk/dsl'
  autoload :Error, 'vk/error'
  autoload :Result, 'vk/result'

  autoload :Base, 'vk/base'
  autoload :User, 'vk/user'
  autoload :City, 'vk/city'
  autoload :Country, 'vk/country'
  autoload :Post, 'vk/post'
  autoload :Stats, 'vk/stats'
  autoload :Group, 'vk/group'
  autoload :Album, 'vk/album'

  class << self
    # @return [String]
    attr_accessor :app_id
    # @return [String]
    attr_accessor :app_secret
  end

  # @return [Logger]
  def self.logger
    @logger ||=
      begin
        require 'logger'
        Logger.new(STDOUT)
      end
  end

  # @param [Logger] logger
  # @return [Logger]
  def self.logger=(logger)
    @logger = logger
  end

  module_function

  # Request to vk.com API
  # @return [Vk::Client] Request object
  def client(access_token = ENV['VK_ACCESS_TOKEN'])
    @client ||= Client.new(access_token)
  end

  # @return [Vk::Client]
  def dsl!
    Client.dsl!
  end

  def log!
    require 'logger'
    self.logger = Logger.new STDOUT
  end

  dsl!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vk-0.6.5.53 lib/vk.rb