Sha256: 4309d8667b269e9a9cdf2dd3aec04b0221bef4fb451b876f28b1be09336234d1

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 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'
    require 'flattr/client/flattrs'

    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
    include Flattr::Client::Flattrs

    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 ||= self.user
    end

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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flattr-0.3.7 lib/flattr/client.rb
flattr-0.3.6 lib/flattr/client.rb
flattr-0.3.5 lib/flattr/client.rb
flattr-0.3.4 lib/flattr/client.rb
flattr-0.3.3 lib/flattr/client.rb
flattr-0.3.2 lib/flattr/client.rb
flattr-0.3.1 lib/flattr/client.rb
flattr-0.3.0 lib/flattr/client.rb