Class: MetaWeblog::Client
- Inherits:
-
Object
- Object
- MetaWeblog::Client
- Defined in:
- lib/metaweblog/client.rb
Instance Attribute Summary collapse
-
#blog_id ⇒ Object
readonly
Returns the value of attribute blog_id.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #edit(post_id, post, publish = true) ⇒ Object
- #get(post_id) ⇒ Object
-
#initialize(uri, blog_id, username, password, proxy = nil) ⇒ Client
constructor
A new instance of Client.
- #post(post, publish = true) ⇒ Object
- #recent_posts(n = 10) ⇒ Object
Constructor Details
#initialize(uri, blog_id, username, password, proxy = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 18 19 |
# File 'lib/metaweblog/client.rb', line 12 def initialize(uri, blog_id, username, password, proxy = nil) @uri = uri @proxy = proxy @blog_id = blog_id @username = username @password = password @client = XMLRPC::Client.new2(@uri, @proxy) end |
Instance Attribute Details
#blog_id ⇒ Object (readonly)
Returns the value of attribute blog_id.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def blog_id @blog_id end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def client @client end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def password @password end |
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def proxy @proxy end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def uri @uri end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
10 11 12 |
# File 'lib/metaweblog/client.rb', line 10 def username @username end |
Instance Method Details
#edit(post_id, post, publish = true) ⇒ Object
29 30 31 |
# File 'lib/metaweblog/client.rb', line 29 def edit(post_id, post, publish=true) client.call('metaWeblog.editPost', post_id, username, password, post, publish) end |
#get(post_id) ⇒ Object
21 22 23 |
# File 'lib/metaweblog/client.rb', line 21 def get(post_id) client.call('metaWeblog.getPost', post_id, username, password) end |
#post(post, publish = true) ⇒ Object
25 26 27 |
# File 'lib/metaweblog/client.rb', line 25 def post(post, publish=true) client.call('metaWeblog.newPost', blog_id, username, password, post, publish) end |
#recent_posts(n = 10) ⇒ Object
33 34 35 |
# File 'lib/metaweblog/client.rb', line 33 def recent_posts(n=10) client.call('metaWeblog.getRecentPosts', blog_id, username, password, n) end |