Class: Tumble::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/tumble/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token, access_secret) ⇒ Client

Initialize a client to use for making requests

Parameters:

  • oauth_token (String)
  • oauth_secret (String)


11
12
13
# File 'lib/tumble/client.rb', line 11

def initialize(access_token, access_secret)
  @connection = Connection.new(access_token, access_secret)
end

Instance Method Details

#blog(name) ⇒ Object



15
16
17
# File 'lib/tumble/client.rb', line 15

def blog(name)
  Blog.new(@connection, name)
end

#dashboard(options = {}) ⇒ Object

Retrieve a User’s Dashboard

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :limit (Integer)

    The number of results to return: 1–20, inclusive

  • :offset (Integer)

    Post number to start at

  • :type (String)

    The type of post to return. Specify one of the following: text, photo, quote, link, chat, audio, video, question

  • :since_id (Integer)

    Return posts that have appeared after this ID

  • :reblog_info (Boolean)

    Indicates whether to return reblog information (specify true or false). Returns the various reblogged_ fields.

  • :notes_info (Boolean)

    Indicates whether to return notes information (specify true or false). Returns note count and note metadata.

See Also:



39
40
41
# File 'lib/tumble/client.rb', line 39

def dashboard(options={})
  @connection.get('/user/dashboard').response
end

#follow(url) ⇒ Object

Follow a Blog

Parameters:

  • url (String)

    The URL of the blog to follow

See Also:



73
74
75
# File 'lib/tumble/client.rb', line 73

def follow(url)
  @connection.post('/user/follow', :url => url).response
end

#following(options = {}) ⇒ Object

Retrieve the Blogs a User Is Following

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :limit (Integer)

    The number of results to return: 1–20, inclusive

  • :offset (Integer)

    Post number to start at

See Also:



63
64
65
# File 'lib/tumble/client.rb', line 63

def following(options={})
  @connection.get('/user/following').response
end

#like(id, reblog_key) ⇒ Object

Like a Post

Parameters:

  • id (Integer)

    The ID of the post to like

  • reblog_key (String)

    The reblog key for the post id

See Also:



94
95
96
# File 'lib/tumble/client.rb', line 94

def like(id, reblog_key)
  @connection.post('/user/like', :id => id, :reblog_key => reblog_key).response
end

#likes(options = {}) ⇒ Object

Retrieve a User’s Likes

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :limit (Integer)

    The number of results to return: 1–20, inclusive

  • :offset (Integer)

    Post number to start at

See Also:



51
52
53
# File 'lib/tumble/client.rb', line 51

def likes(options={})
  @connection.get('/user/likes').response
end

#unfollow(url) ⇒ Object

Unfollow a Blog

Parameters:

  • url (String)

    The URL of the blog to follow

See Also:



83
84
85
# File 'lib/tumble/client.rb', line 83

def unfollow(url)
  @connection.post('/user/unfollow', :url => url).response
end

#unlike(id, reblog_key) ⇒ Object

Unlike a Post

Parameters:

  • id (Integer)

    The ID of the post to unlike

  • reblog_key (String)

    The reblog key for the post id

See Also:



105
106
107
# File 'lib/tumble/client.rb', line 105

def unlike(id, reblog_key)
  @connection.post('/user/unlike', :id => id, :reblog_key => reblog_key).response
end

#user_infoObject

Get Info for the Authenticated User



23
24
25
# File 'lib/tumble/client.rb', line 23

def 
  @connection.post('/user/info').response
end