Class: Tumblr::Client

Inherits:
Object
  • Object
show all
Includes:
Blog, Connection, Helper, Post, Request, Tagged, User
Defined in:
lib/tumblr/client.rb

Constant Summary

Constants included from Post

Post::DATA_POST_TYPES, Post::STANDARD_POST_OPTIONS, Post::VALID_POST_TYPES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Connection

#connection

Methods included from Tagged

#tagged

Methods included from Post

#audio, #chat, #create_post, #delete, #edit, #link, #photo, #quote, #reblog, #text, #video

Methods included from User

#dashboard, #follow, #following, #info, #like, #likes, #unfollow, #unlike

Methods included from Blog

#avatar, #blog_info, #blog_likes, #draft, #followers, #posts, #queue, #submissions

Methods included from Request

#get, #get_redirect_url, #get_response, #post, #respond

Constructor Details

#initialize(attrs = {}) ⇒ Client

Returns a new instance of Client.



26
27
28
29
30
31
# File 'lib/tumblr/client.rb', line 26

def initialize(attrs= {})
  attrs = Tumblr.options.merge(attrs)
  Config::VALID_OPTIONS_KEYS.each do |key|
    instance_variable_set("@#{key}".to_sym, attrs[key])
  end
end

Class Method Details

.default_api_hostObject



13
14
15
# File 'lib/tumblr/client.rb', line 13

def default_api_host
  ENV['TUMBLR_API_HOST'] || 'api.tumblr.com'
end

Instance Method Details

#api_hostObject



33
34
35
# File 'lib/tumblr/client.rb', line 33

def api_host
  self.class.default_api_host
end

#api_schemeObject



37
38
39
# File 'lib/tumblr/client.rb', line 37

def api_scheme
  @api_scheme || 'https'
end

#credentialsObject



41
42
43
44
45
46
47
48
# File 'lib/tumblr/client.rb', line 41

def credentials
  {
    :consumer_key => @consumer_key,
    :consumer_secret => @consumer_secret,
    :token => @oauth_token,
    :token_secret => @oauth_token_secret
  }
end