Sha256: c73e07726c339b2f99763a18dc513aff0515ef10632ee48219e9c6a5c889a701

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'flattr/config'
require 'flattr/connection'
require 'flattr/request'
require 'flattr/user'
require 'flattr/thing'
require 'flattr/search'
require 'flattr/language'
require 'flattr/category'
require 'flattr/version'
require 'flattr/oauth2'
require 'flattr/authenticatable'

module Flattr
  class Client
    require 'flattr/client/users'
    require 'flattr/client/things'
    require 'flattr/client/languages'
    require 'flattr/client/categories'

    include Flattr::Connection
    include Flattr::Request

    include Flattr::Authenticatable
    include Flattr::OAuth2

    include Flattr::Client::Users
    include Flattr::Client::Things
    include Flattr::Client::Languages
    include Flattr::Client::Categories

    attr_accessor *Config::VALID_OPTIONS_KEYS

    # Initializes a new API object
    #
    # @param attrs [Hash]
    # @return [Flattr::Client]
    def initialize(attrs={})
      attrs = Flattr.options.merge(attrs)
      Config::VALID_OPTIONS_KEYS.each do |key|
        instance_variable_set("@#{key}".to_sym, attrs[key])
      end
    end

    # Returns the configured name or the name of the authenticated user
    #
    # @return [Flattr::User]
    def current_user
      @current_user ||= Flattr::User.new(self.verify_credentials)
    end

    def base64_encode str
      [str].pack("m9999").chomp
    end


  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flattr-0.2.3 lib/flattr/client.rb