rubypress 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/lib/rubypress/client.rb +7 -7
- data/lib/rubypress/comments.rb +7 -7
- data/lib/rubypress/media.rb +3 -3
- data/lib/rubypress/options.rb +2 -2
- data/lib/rubypress/posts.rb +9 -9
- data/lib/rubypress/taxonomies.rb +10 -10
- data/lib/rubypress/users.rb +6 -6
- data/lib/rubypress.rb +12 -10
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MTQ5NTg1ZGFlYjBlMTdjYWQ5NTcxODA1NGI4ZDJjYTAzZTkzOTZkMTk0ZmZk
|
10
|
-
ZTQxMmVlYjIxZGFjNGUxY2MyOTkxNGY3MWJjMzc2NWEzMzdjNTM3NzFhYWZj
|
11
|
-
OTdmMzZhYjU2YzIxZWI0MzdkMzg3MjNkYmRmMDVkY2JjNDUyOTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Njc5ZTI3ZTE4OWU4ZTBlOTQwZjZmNjM1Mjc1MGY3N2MzNmZhYTUzZThmODFk
|
14
|
-
ZWVjZmU5MTRmMWZiZDkzZDI3OWRjNTVjZTkwNTQzMWY1ZmFmNjdiNTk4OTVm
|
15
|
-
OTJmOTNkMDVhNDA1N2Y3OTZiYWI5MjdiYWU5NTY5ZWE4MzNlZTE=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ca70bc44abc4943798aefac711fdc08dfeffa4be
|
4
|
+
data.tar.gz: 1abae76f9dcfe1ced638c4a696863eef3e5bae91
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce9caff1c6ed052027d0f952938d5bb30b67e3d3e67049afd3c5c48c9302050c48b29897f6be3cadae365dcfed0b6bc79fa52aa2972d9b88d93617c0ed44498d
|
7
|
+
data.tar.gz: 2e3b934793950856d8c4df83856740334f7fc780066e008c0a183ffa0b1677c569d0afb6dd015520b38f08925079fe1af54e988abdcde69e267446a4e6de96b0
|
data/lib/rubypress/client.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'erb'
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
3
|
+
require_relative 'posts'
|
4
|
+
require_relative 'taxonomies'
|
5
|
+
require_relative 'media'
|
6
|
+
require_relative 'comments'
|
7
|
+
require_relative 'options'
|
8
|
+
require_relative 'users'
|
9
9
|
|
10
10
|
module Rubypress
|
11
11
|
|
@@ -22,7 +22,7 @@ module Rubypress
|
|
22
22
|
:path => '/xmlrpc.php',
|
23
23
|
:username => nil,
|
24
24
|
:password => nil,
|
25
|
-
:default_post_fields =>
|
25
|
+
:default_post_fields => %w(post terms custom_fields),
|
26
26
|
:debug => false
|
27
27
|
}.merge(options).each{ |opt| self.send("#{opt[0]}=", opt[1]) }
|
28
28
|
self
|
data/lib/rubypress/comments.rb
CHANGED
@@ -4,21 +4,21 @@ module Comments
|
|
4
4
|
default_options = {
|
5
5
|
:post_id => nil
|
6
6
|
}.deep_merge!(options)
|
7
|
-
execute(
|
7
|
+
execute('getCommentCount', default_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def getComment(options = {})
|
11
11
|
default_options = {
|
12
12
|
:comment_id => nil
|
13
13
|
}.deep_merge!(options)
|
14
|
-
execute(
|
14
|
+
execute('getComment', default_options)
|
15
15
|
end
|
16
16
|
|
17
17
|
def getComments(options = {})
|
18
18
|
default_options = {
|
19
19
|
:filter => {}
|
20
20
|
}.deep_merge!(options)
|
21
|
-
execute(
|
21
|
+
execute('getComments', default_options)
|
22
22
|
end
|
23
23
|
|
24
24
|
def newComment(options = {})
|
@@ -26,7 +26,7 @@ module Comments
|
|
26
26
|
:post_id => nil,
|
27
27
|
:comment => {}
|
28
28
|
}.deep_merge!(options)
|
29
|
-
execute(
|
29
|
+
execute('newComment', default_options)
|
30
30
|
end
|
31
31
|
|
32
32
|
def editComment(options = {})
|
@@ -34,18 +34,18 @@ module Comments
|
|
34
34
|
:comment_id => nil,
|
35
35
|
:comment => {}
|
36
36
|
}.deep_merge!(options)
|
37
|
-
execute(
|
37
|
+
execute('editComment', default_options)
|
38
38
|
end
|
39
39
|
|
40
40
|
def deleteComment(options = {})
|
41
41
|
default_options = {
|
42
42
|
:comment_id => nil
|
43
43
|
}.deep_merge!(options)
|
44
|
-
execute(
|
44
|
+
execute('deleteComment', default_options)
|
45
45
|
end
|
46
46
|
|
47
47
|
def getCommentStatusList(options = {})
|
48
|
-
execute(
|
48
|
+
execute('getCommentStatusList', options)
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
data/lib/rubypress/media.rb
CHANGED
@@ -4,21 +4,21 @@ module Media
|
|
4
4
|
default_options = {
|
5
5
|
:attachment_id => nil
|
6
6
|
}.deep_merge!(options)
|
7
|
-
execute(
|
7
|
+
execute('getMediaItem', default_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def getMediaLibrary(options = {})
|
11
11
|
default_options = {
|
12
12
|
:filter => {}
|
13
13
|
}.deep_merge!(options)
|
14
|
-
execute(
|
14
|
+
execute('getMediaLibrary', default_options)
|
15
15
|
end
|
16
16
|
|
17
17
|
def uploadFile(options = {})
|
18
18
|
default_options = {
|
19
19
|
:data => {}
|
20
20
|
}.deep_merge!(options)
|
21
|
-
execute(
|
21
|
+
execute('uploadFile', default_options)
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
data/lib/rubypress/options.rb
CHANGED
@@ -4,14 +4,14 @@ module Options
|
|
4
4
|
default_options = {
|
5
5
|
:options => []
|
6
6
|
}.deep_merge!(options)
|
7
|
-
execute(
|
7
|
+
execute('getOptions', default_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def setOptions(options = {})
|
11
11
|
default_options = {
|
12
12
|
:options => []
|
13
13
|
}.deep_merge!(options)
|
14
|
-
execute(
|
14
|
+
execute('setOptions', default_options)
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
data/lib/rubypress/posts.rb
CHANGED
@@ -5,7 +5,7 @@ module Posts
|
|
5
5
|
:post_id => nil,
|
6
6
|
:fields => self.default_post_fields
|
7
7
|
}.deep_merge!(options)
|
8
|
-
execute(
|
8
|
+
execute('getPost', default_options)
|
9
9
|
end
|
10
10
|
|
11
11
|
def getPosts(options = {})
|
@@ -17,14 +17,14 @@ module Posts
|
|
17
17
|
:fields => self.default_post_fields
|
18
18
|
}
|
19
19
|
}.deep_merge!(options)
|
20
|
-
execute(
|
20
|
+
execute('getPosts', default_options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def newPost(options = {})
|
24
24
|
default_options = {
|
25
25
|
:content => {}
|
26
26
|
}.deep_merge!(options)
|
27
|
-
execute(
|
27
|
+
execute('newPost', default_options)
|
28
28
|
end
|
29
29
|
|
30
30
|
def editPost(options = {})
|
@@ -32,14 +32,14 @@ module Posts
|
|
32
32
|
:post_id => nil,
|
33
33
|
:content => {}
|
34
34
|
}.deep_merge!(options)
|
35
|
-
execute(
|
35
|
+
execute('editPost', default_options)
|
36
36
|
end
|
37
37
|
|
38
38
|
def deletePost(options = {})
|
39
39
|
default_options = {
|
40
40
|
:post_id => nil
|
41
41
|
}.deep_merge!(options)
|
42
|
-
execute(
|
42
|
+
execute('deletePost', default_options)
|
43
43
|
end
|
44
44
|
|
45
45
|
def getPostType(options = {})
|
@@ -47,7 +47,7 @@ module Posts
|
|
47
47
|
:post_type_name => nil,
|
48
48
|
:fields => []
|
49
49
|
}.deep_merge!(options)
|
50
|
-
execute(
|
50
|
+
execute('getPostType', default_options)
|
51
51
|
end
|
52
52
|
|
53
53
|
def getPostTypes(options = {})
|
@@ -55,18 +55,18 @@ module Posts
|
|
55
55
|
:filter => {},
|
56
56
|
:fields => []
|
57
57
|
}.deep_merge!(options)
|
58
|
-
execute(
|
58
|
+
execute('getPostTypes', default_options)
|
59
59
|
end
|
60
60
|
|
61
61
|
def getPostFormats(options = {})
|
62
62
|
default_options = {
|
63
63
|
:filter => {}
|
64
64
|
}.deep_merge!(options)
|
65
|
-
execute(
|
65
|
+
execute('getPostFormats', default_options)
|
66
66
|
end
|
67
67
|
|
68
68
|
def getPostStatusList(options = {})
|
69
|
-
execute(
|
69
|
+
execute('getPostFormats', options)
|
70
70
|
end
|
71
71
|
|
72
72
|
end
|
data/lib/rubypress/taxonomies.rb
CHANGED
@@ -2,36 +2,36 @@ module Taxonomies
|
|
2
2
|
|
3
3
|
def getTaxonomy(options = {})
|
4
4
|
default_options = {
|
5
|
-
:taxonomy =>
|
5
|
+
:taxonomy => 'category'
|
6
6
|
}.deep_merge!(options)
|
7
|
-
execute(
|
7
|
+
execute('getTaxonomy', default_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def getTaxonomies(options = {})
|
11
|
-
execute(
|
11
|
+
execute('getTaxonomies', options)
|
12
12
|
end
|
13
13
|
|
14
14
|
def getTerm(options = {})
|
15
15
|
default_options = {
|
16
|
-
:taxonomy =>
|
16
|
+
:taxonomy => 'category',
|
17
17
|
:term_id => nil
|
18
18
|
}.deep_merge!(options)
|
19
|
-
execute(
|
19
|
+
execute('getTerm', default_options)
|
20
20
|
end
|
21
21
|
|
22
22
|
def getTerms(options = {})
|
23
23
|
default_options = {
|
24
|
-
:taxonomy =>
|
24
|
+
:taxonomy => 'category',
|
25
25
|
:filter => {}
|
26
26
|
}.deep_merge!(options)
|
27
|
-
execute(
|
27
|
+
execute('getTerms', default_options)
|
28
28
|
end
|
29
29
|
|
30
30
|
def newTerm(options = {})
|
31
31
|
default_options = {
|
32
32
|
:content => {}
|
33
33
|
}.deep_merge!(options)
|
34
|
-
execute(
|
34
|
+
execute('newTerm', default_options)
|
35
35
|
end
|
36
36
|
|
37
37
|
def editTerm(options = {})
|
@@ -39,7 +39,7 @@ module Taxonomies
|
|
39
39
|
:term_id => nil,
|
40
40
|
:content => {}
|
41
41
|
}.deep_merge!(options)
|
42
|
-
execute(
|
42
|
+
execute('editTerm', default_options)
|
43
43
|
end
|
44
44
|
|
45
45
|
def deleteTerm(options = {})
|
@@ -47,7 +47,7 @@ module Taxonomies
|
|
47
47
|
:taxonomy => nil,
|
48
48
|
:term_id => nil
|
49
49
|
}.deep_merge!(options)
|
50
|
-
execute(
|
50
|
+
execute('deleteTerm', default_options)
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
data/lib/rubypress/users.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Users
|
2
2
|
|
3
3
|
def getUsersBlogs
|
4
|
-
self.connection.call(
|
4
|
+
self.connection.call('wp.getUsersBlogs', self.username, self.password)
|
5
5
|
end
|
6
6
|
|
7
7
|
def getUser(options = {})
|
@@ -9,32 +9,32 @@ module Users
|
|
9
9
|
:user_id => nil,
|
10
10
|
:fields => []
|
11
11
|
}.deep_merge!(options)
|
12
|
-
execute(
|
12
|
+
execute('getUser', default_options)
|
13
13
|
end
|
14
14
|
|
15
15
|
def getUsers(options = {})
|
16
16
|
default_options = {
|
17
17
|
:filter => {}
|
18
18
|
}.deep_merge!(options)
|
19
|
-
execute(
|
19
|
+
execute('getUsers', default_options)
|
20
20
|
end
|
21
21
|
|
22
22
|
def getProfile(options = {})
|
23
23
|
default_options = {
|
24
24
|
:fields => []
|
25
25
|
}.deep_merge!(options)
|
26
|
-
execute(
|
26
|
+
execute('getProfile', default_options)
|
27
27
|
end
|
28
28
|
|
29
29
|
def editProfile(options = {})
|
30
30
|
default_options = {
|
31
31
|
:content => {}
|
32
32
|
}.deep_merge!(options)
|
33
|
-
execute(
|
33
|
+
execute('editProfile', default_options)
|
34
34
|
end
|
35
35
|
|
36
36
|
def getAuthors(options = {})
|
37
|
-
execute(
|
37
|
+
execute('getAuthors', options)
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
data/lib/rubypress.rb
CHANGED
@@ -3,20 +3,22 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) unless $LOAD_PATH.include?(File.dirna
|
|
3
3
|
require 'xmlrpc/client'
|
4
4
|
require 'rubypress/client'
|
5
5
|
|
6
|
-
|
6
|
+
unless defined?(ActiveSupport)
|
7
|
+
class Hash
|
8
|
+
|
9
|
+
def deep_merge!(other_hash)
|
10
|
+
other_hash.each_pair do |k, v|
|
11
|
+
tv = self[k]
|
12
|
+
self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v
|
13
|
+
end
|
14
|
+
self
|
15
|
+
end
|
7
16
|
|
8
|
-
|
9
|
-
|
10
|
-
tv = self[k]
|
11
|
-
self[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_merge(v) : v
|
17
|
+
def deep_merge(other_hash)
|
18
|
+
dup.deep_merge!(other_hash)
|
12
19
|
end
|
13
|
-
self
|
14
|
-
end
|
15
20
|
|
16
|
-
def deep_merge(other_hash)
|
17
|
-
dup.deep_merge!(other_hash)
|
18
21
|
end
|
19
|
-
|
20
22
|
end
|
21
23
|
|
22
24
|
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Feldman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Easily
|
14
|
-
|
15
|
-
|
13
|
+
description: Easily access WordPress installations through the WordPress XML-RPC API.
|
14
|
+
This gem exactly mirrors the functionality provided by the WordPress XML-RPC API
|
15
|
+
in Ruby.
|
16
16
|
email:
|
17
17
|
- zachfeldman@gmail.com
|
18
18
|
executables: []
|
@@ -36,12 +36,12 @@ require_paths:
|
|
36
36
|
- lib
|
37
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 1.9.2
|
42
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|