Class: Posterous::User
- Inherits:
-
Object
- Object
- Posterous::User
- Includes:
- Connection, OldAPI
- Defined in:
- lib/posterous_api/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
-
#blogs ⇒ Object
Return all the sites for that user.
-
#create_post_for(options) ⇒ Object
Create a new post in a blog.
-
#credentials ⇒ Object
Return the credentials to use with the old API.
-
#initialize(email, password) ⇒ User
constructor
Initialize of a Client with email and password.
-
#posts_from(options = {}) ⇒ Object
(also: #posts)
Return all the posts from a blog.
-
#tags_from(options = {}) ⇒ Object
Return all the tags from a blog.
Methods included from OldAPI
#get_all_sites_uri, #get_tags_uri, #new_post_uri, #read_posts_uri, #update_post_uri
Methods included from BaseURI
Methods included from Connection
Constructor Details
#initialize(email, password) ⇒ User
Initialize of a Client with email and password
11 12 13 14 |
# File 'lib/posterous_api/user.rb', line 11 def initialize(email, password) @email = email @password = password end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/posterous_api/user.rb', line 3 def email @email end |
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/posterous_api/user.rb', line 3 def password @password end |
Instance Method Details
#blogs ⇒ Object
Return all the sites for that user
user.blogs
28 29 30 |
# File 'lib/posterous_api/user.rb', line 28 def blogs get(get_all_sites_uri) end |
#create_post_for(options) ⇒ Object
Create a new post in a blog
user.create_post_for :blog => ‘123456’, :title => ‘My title’, :body => ‘Body’
53 54 55 56 57 58 |
# File 'lib/posterous_api/user.rb', line 53 def create_post_for() site_id = [:blog] .delete(:blog) [:site_id] = site_id post(new_post_uri, ) end |
#credentials ⇒ Object
Return the credentials to use with the old API
user.credentials
20 21 22 |
# File 'lib/posterous_api/user.rb', line 20 def credentials { :username => @email, :password => @password } end |
#posts_from(options = {}) ⇒ Object Also known as: posts
Return all the posts from a blog
user.posts_from :blog => ‘123456’
36 37 38 |
# File 'lib/posterous_api/user.rb', line 36 def posts_from(={}) get(read_posts_uri, { :site_id => [:blog]}) end |
#tags_from(options = {}) ⇒ Object
Return all the tags from a blog
user.tags_from :blog => ‘123456’
45 46 47 |
# File 'lib/posterous_api/user.rb', line 45 def (={}) get(, { :site_id => [:blog]}) end |