metaweblog 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +10 -0
- data/lib/metaweblog/client.rb +4 -0
- data/lib/metaweblog/version.rb +1 -1
- data/spec/metaweblog/client_spec.rb +35 -0
- data/spec/spec_helper.rb +9 -0
- metadata +7 -6
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -39,6 +39,16 @@ Or install it yourself as:
|
|
39
39
|
|
40
40
|
`MetaWeblog::Client#post` returns `post_id` of new entry if the entry is posted successfully.
|
41
41
|
|
42
|
+
|
43
|
+
### Get an existing entry
|
44
|
+
|
45
|
+
Just calling `get` method with post_id:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
post = client.get(post_id)
|
49
|
+
```
|
50
|
+
|
51
|
+
|
42
52
|
### Edit an existing entry
|
43
53
|
|
44
54
|
```ruby
|
data/lib/metaweblog/client.rb
CHANGED
@@ -18,6 +18,10 @@ module MetaWeblog
|
|
18
18
|
@client = XMLRPC::Client.new2(@uri, @proxy)
|
19
19
|
end
|
20
20
|
|
21
|
+
def get(post_id)
|
22
|
+
client.call('metaWeblog.getPost', post_id, username, password)
|
23
|
+
end
|
24
|
+
|
21
25
|
def post(post, publish=true)
|
22
26
|
client.call('metaWeblog.newPost', blog_id, username, password, post, publish)
|
23
27
|
end
|
data/lib/metaweblog/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe MetaWeblog::Client do
|
6
|
+
before do
|
7
|
+
@client = MetaWeblog::Client.new('http://blog.example.com/xmlrpc',
|
8
|
+
'blog_id',
|
9
|
+
'username',
|
10
|
+
'password')
|
11
|
+
@xml_client = stub()
|
12
|
+
@client.instance_variable_set(:@client, @xml_client)
|
13
|
+
end
|
14
|
+
describe "#post" do
|
15
|
+
let(:expected_post) { MetaWeblog::Post.new('title', 'hogehoge') }
|
16
|
+
before do
|
17
|
+
@xml_client.should_receive(:call).with('metaWeblog.newPost',
|
18
|
+
'blog_id',
|
19
|
+
'username', 'password',
|
20
|
+
expected_post, true)
|
21
|
+
end
|
22
|
+
it do
|
23
|
+
expect { @client.post(expected_post) }.not_to raise_error
|
24
|
+
end
|
25
|
+
end
|
26
|
+
describe "#get" do
|
27
|
+
let(:post_id) { 12345 }
|
28
|
+
before do
|
29
|
+
@xml_client.should_receive(:call).with('metaWeblog.getPost', post_id, 'username', 'password')
|
30
|
+
end
|
31
|
+
it do
|
32
|
+
expect { @client.get(post_id) }.not_to raise_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaweblog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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: 2013-03
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -77,6 +77,8 @@ files:
|
|
77
77
|
- lib/metaweblog/client.rb
|
78
78
|
- lib/metaweblog/version.rb
|
79
79
|
- metaweblog.gemspec
|
80
|
+
- spec/metaweblog/client_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
80
82
|
homepage: http://github.com/satoryu/metaweblog
|
81
83
|
licenses:
|
82
84
|
- MIT
|
@@ -96,13 +98,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
98
|
- - ! '>='
|
97
99
|
- !ruby/object:Gem::Version
|
98
100
|
version: '0'
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
hash: 2454089130755583863
|
102
101
|
requirements: []
|
103
102
|
rubyforge_project:
|
104
103
|
rubygems_version: 1.8.25
|
105
104
|
signing_key:
|
106
105
|
specification_version: 3
|
107
106
|
summary: Ruby client for metaWeblog API.
|
108
|
-
test_files:
|
107
|
+
test_files:
|
108
|
+
- spec/metaweblog/client_spec.rb
|
109
|
+
- spec/spec_helper.rb
|