Class: Flattr::Client

Inherits:
Object
  • Object
show all
Includes:
Authenticatable, Categories, Flattrs, Languages, Things, Users, Connection, OAuth2, Request
Defined in:
lib/flattr/client.rb,
lib/flattr/client/users.rb,
lib/flattr/client/things.rb,
lib/flattr/client/flattrs.rb,
lib/flattr/client/languages.rb,
lib/flattr/client/categories.rb

Defined Under Namespace

Modules: Categories, Flattrs, Languages, Things, Users

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Flattrs

#flattr

Methods included from Categories

#categories, #category

Methods included from Languages

#languages

Methods included from Things

#thing, #thing_delete, #thing_flattrs, #thing_lookup, #thing_new, #thing_search, #thing_update, #things

Methods included from Users

#user, #user_flattrs, #user_things

Methods included from OAuth2

#authorize_url, #get_access_token

Methods included from Authenticatable

#credentials, #credentials?

Methods included from Request

#delete, #get, #patch, #post, #put

Constructor Details

#initialize(attrs = {}) ⇒ Flattr::Client

Initializes a new API object

Parameters:

  • attrs (Hash) (defaults to: {})


39
40
41
42
43
44
# File 'lib/flattr/client.rb', line 39

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

Class Method Details

.base64_encode(str) ⇒ Object



53
54
55
# File 'lib/flattr/client.rb', line 53

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

Instance Method Details

#current_userFlattr::User

Returns the configured name or the name of the authenticated user

Returns:



49
50
51
# File 'lib/flattr/client.rb', line 49

def current_user
  @current_user ||= self.user
end