wp_rpc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,7 +33,7 @@ Or install it yourself as:
33
33
  blog.posts.find_recent(:limit => 20).map { |p| puts "#{p.id} | #{p.title}" }
34
34
 
35
35
  # Create a new blog post
36
- post = blog.posts.new(:title => 'Test', :description => 'This is a test', :keywords => 'test, testing', :published => true)
36
+ post = blog.posts.new(:title => 'Test', :content => 'This is a test', :keywords => 'test, testing', :published => true)
37
37
  post.save
38
38
 
39
39
  # Edit a blog post
@@ -44,6 +44,24 @@ Or install it yourself as:
44
44
  # Upload an attachment
45
45
  attachment = blog.attachments.new(:name => 'Photo of me', :filename => '/home/john/me.jpg')
46
46
  attachment.save
47
+
48
+ # Retrieve list of supported values for post_status field on posts.
49
+ blog.posts.status
50
+
51
+ # Retrieve list of post formats.
52
+ blog.posts.formats
53
+
54
+ # Retrieve list of registered post types.
55
+ blog.posts.types
56
+
57
+ # Retrieve a registered post type.
58
+ blog.posts.type('page')
59
+
60
+ # Delete an existing post of any registered post type.
61
+ blog.posts.delete(post.id)
62
+
63
+ # Delete several existing posts of any registered post type.
64
+ blog.posts.delete([1,2])
47
65
 
48
66
  ### Contributing
49
67
 
@@ -0,0 +1,6 @@
1
+ ## 0.0.2
2
+
3
+ - Retrieve list of supported values for post_status field on posts.
4
+ - Retrieve list of post formats.
5
+ - Retrieve list of registered post types.
6
+ - Delete an existing post or posts of any registered post type.
@@ -25,6 +25,34 @@ module WpRpc
25
25
  def all
26
26
  change_attributes(conn.call('wp.getPosts', conn.blog_id, conn.username, conn.password), pattern)
27
27
  end
28
+
29
+ def delete(ids)
30
+ posts = {}
31
+ if ids.is_a?(Array)
32
+ ids.each do |id|
33
+ posts = posts.merge({id => conn.call('wp.deletePost', conn.blog_id, conn.username, conn.password, id) })
34
+ end
35
+ posts
36
+ else
37
+ conn.call('wp.deletePost', conn.blog_id, conn.username, conn.password, id)
38
+ end
39
+ end
40
+
41
+ def status
42
+ conn.call('wp.getPostStatusList', conn.blog_id, conn.username, conn.password)
43
+ end
44
+
45
+ def formats
46
+ conn.call('wp.getPostFormats', conn.blog_id, conn.username, conn.password)
47
+ end
48
+
49
+ def types
50
+ conn.call('wp.getPostTypes', conn.blog_id, conn.username, conn.password)
51
+ end
52
+
53
+ def type(name)
54
+ conn.call('wp.getPostType', conn.blog_id, conn.username, conn.password, name)
55
+ end
28
56
  end
29
57
  end
30
58
  end
@@ -1,3 +1,3 @@
1
1
  module WpRpc
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp_rpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-10-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby library to interact with the Wordpress XMLRPC interface
15
15
  email:
@@ -24,6 +24,7 @@ files:
24
24
  - LICENSE
25
25
  - README.md
26
26
  - Rakefile
27
+ - changelog.md
27
28
  - lib/wp_rpc.rb
28
29
  - lib/wp_rpc/attachment.rb
29
30
  - lib/wp_rpc/base.rb