pinboard 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,13 +11,13 @@ module Pinboard
11
11
  end
12
12
 
13
13
  def posts(params={})
14
- options = {}
14
+ options = {}
15
15
  options[:basic_auth] = @auth
16
- options[:query] = params
16
+ options[:query] = params
17
17
  posts = self.class.get('/posts/all', options)['posts']['post']
18
- if !posts.nil?
19
- posts.map { |p| Post.new(Util.symbolize_keys(p)) }
20
- end
18
+ posts = [] if posts.nil?
19
+ posts = [posts] if posts.class != Array
20
+ posts.map { |p| Post.new(Util.symbolize_keys(p)) }
21
21
  end
22
22
  end
23
23
  end
data/pinboard.gemspec CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |s|
9
9
  s.add_development_dependency "rb-fsevent"
10
10
  end
11
11
 
12
- s.add_runtime_dependency 'httparty', '~> 0.7'
12
+ s.add_runtime_dependency 'httparty', '= 0.7.8'
13
13
  s.name = 'pinboard'
14
- s.version = '0.0.3'
15
- s.date = '2011-12-14'
14
+ s.version = '0.0.4'
15
+ s.date = '2012-05-08'
16
16
  s.summary = "Ruby wrapper for the Pinboard API"
17
17
  s.description = "Ruby wrapper for the Pinboard API"
18
18
  s.authors = ["Ryan Waker"]
File without changes
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <posts user="user">
3
+ </posts>
4
+
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <posts user="user">
3
+ <post href="http://foo.com/"
4
+ time="2011-07-26T17:52:04Z"
5
+ description="Foo!"
6
+ extended=""
7
+ tag="foo bar"
8
+ hash="0c85c54332a588d18a85e963257e8fbc"
9
+ meta="5cea9129d6a4f10e4790cc8665c48423"
10
+ toread="yes"
11
+ />
12
+ </posts>
13
+
@@ -4,27 +4,54 @@ describe Pinboard::Client do
4
4
  describe "#posts" do
5
5
  let(:client) { Pinboard::Client.new(auth_params) }
6
6
 
7
- before do
8
- stub_get("posts/all?").
9
- to_return(:body => fixture("posts_all.xml"),
10
- :headers => { 'content-type' => 'text/xml' })
7
+ context "when there are many posts" do
8
+ before do
9
+ stub_get("posts/all?").
10
+ to_return(:body => fixture("multiple_posts.xml"),
11
+ :headers => { 'content-type' => 'text/xml' })
12
+ end
13
+
14
+ it "returns a collection of posts" do
15
+ expected =
16
+ [
17
+ Pinboard::Post.new(
18
+ :href => "http://foo.com/",
19
+ :description => "Foo!",
20
+ :tag => 'foo bar',
21
+ :time => Time.parse("2011-07-26T17:52:04Z")),
22
+ Pinboard::Post.new(
23
+ :href => "http://bar.com/",
24
+ :description => "Bar!",
25
+ :tag => 'foo bar',
26
+ :time => Time.parse("2011-07-26T17:52:04Z")),
27
+ ]
28
+
29
+ client.posts.should == expected
30
+ end
31
+ end
32
+
33
+ context "where there is a single post" do
34
+ before do
35
+ stub_get("posts/all?").
36
+ to_return(:body => fixture("single_post.xml"),
37
+ :headers => { 'content-type' => 'text/xml' })
38
+ end
39
+
40
+ it "still returns an array" do
41
+ client.posts.class.should == Array
42
+ end
11
43
  end
12
44
 
13
- it "returns a collection of posts" do
14
- expected = [
15
- Pinboard::Post.new(
16
- :href => "http://foo.com/",
17
- :description => "Foo!",
18
- :tag => 'foo bar',
19
- :time => Time.parse("2011-07-26T17:52:04Z")),
20
- Pinboard::Post.new(
21
- :href => "http://bar.com/",
22
- :description => "Bar!",
23
- :tag => 'foo bar',
24
- :time => Time.parse("2011-07-26T17:52:04Z"))
25
- ]
26
-
27
- client.posts.should == expected
45
+ context "when there are no posts" do
46
+ before do
47
+ stub_get("posts/all?").
48
+ to_return(:body => fixture("no_posts.xml"),
49
+ :headers => { 'content-type' => 'text/xml' })
50
+ end
51
+
52
+ it "returns an empty array" do
53
+ client.posts.should == []
54
+ end
28
55
  end
29
56
  end
30
57
  end
@@ -7,7 +7,7 @@ describe Pinboard::Post do
7
7
 
8
8
  before do
9
9
  stub_get("posts/all").
10
- to_return(:body => fixture("posts_all.xml"),
10
+ to_return(:body => fixture("multiple_posts.xml"),
11
11
  :headers => { 'content-type' => 'text/xml' })
12
12
  end
13
13
 
@@ -23,7 +23,7 @@ describe Pinboard::Post do
23
23
  post.time.should == Time.parse('Tue Jul 26 17:52:04 UTC 2011')
24
24
  end
25
25
  end
26
-
26
+
27
27
  describe ".new" do
28
28
  let(:post) {
29
29
  Pinboard::Post.new(
@@ -41,3 +41,4 @@ describe Pinboard::Post do
41
41
  end
42
42
  end
43
43
  end
44
+
metadata CHANGED
@@ -1,149 +1,110 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pinboard
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ryan Waker
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-14 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: yard
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70278122833360 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 5
29
- segments:
30
- - 0
31
- - 7
32
- version: "0.7"
20
+ - !ruby/object:Gem::Version
21
+ version: '0.7'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rake
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70278122833360
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70278122832800 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
29
+ requirements:
41
30
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 25
44
- segments:
45
- - 0
46
- - 9
47
- version: "0.9"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
48
33
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rspec
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70278122832800
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70278122832180 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
40
+ requirements:
56
41
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 15
59
- segments:
60
- - 2
61
- - 6
62
- version: "2.6"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
63
44
  type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: webmock
67
45
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70278122832180
47
+ - !ruby/object:Gem::Dependency
48
+ name: webmock
49
+ requirement: &70278122831160 !ruby/object:Gem::Requirement
69
50
  none: false
70
- requirements:
51
+ requirements:
71
52
  - - ~>
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 1
76
- - 6
77
- version: "1.6"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
78
55
  type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: guard-rspec
82
56
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70278122831160
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-rspec
60
+ requirement: &70278122829380 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
62
+ requirements:
86
63
  - - ~>
87
- - !ruby/object:Gem::Version
88
- hash: 1
89
- segments:
90
- - 0
91
- - 5
92
- version: "0.5"
64
+ - !ruby/object:Gem::Version
65
+ version: '0.5'
93
66
  type: :development
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: growl_notify
97
67
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70278122829380
69
+ - !ruby/object:Gem::Dependency
70
+ name: growl_notify
71
+ requirement: &70278122828800 !ruby/object:Gem::Requirement
99
72
  none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
107
77
  type: :development
108
- version_requirements: *id006
109
- - !ruby/object:Gem::Dependency
110
- name: rb-fsevent
111
78
  prerelease: false
112
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70278122828800
80
+ - !ruby/object:Gem::Dependency
81
+ name: rb-fsevent
82
+ requirement: &70278122827920 !ruby/object:Gem::Requirement
113
83
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
121
88
  type: :development
122
- version_requirements: *id007
123
- - !ruby/object:Gem::Dependency
124
- name: httparty
125
89
  prerelease: false
126
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *70278122827920
91
+ - !ruby/object:Gem::Dependency
92
+ name: httparty
93
+ requirement: &70278122820580 !ruby/object:Gem::Requirement
127
94
  none: false
128
- requirements:
129
- - - ~>
130
- - !ruby/object:Gem::Version
131
- hash: 5
132
- segments:
133
- - 0
134
- - 7
135
- version: "0.7"
95
+ requirements:
96
+ - - =
97
+ - !ruby/object:Gem::Version
98
+ version: 0.7.8
136
99
  type: :runtime
137
- version_requirements: *id008
100
+ prerelease: false
101
+ version_requirements: *70278122820580
138
102
  description: Ruby wrapper for the Pinboard API
139
103
  email: ry@anotherventure.com
140
104
  executables: []
141
-
142
105
  extensions: []
143
-
144
106
  extra_rdoc_files: []
145
-
146
- files:
107
+ files:
147
108
  - .autotest
148
109
  - .gitignore
149
110
  - .rspec
@@ -158,49 +119,43 @@ files:
158
119
  - lib/pinboard/post.rb
159
120
  - lib/pinboard/util.rb
160
121
  - pinboard.gemspec
161
- - spec/fixtures/posts_all.xml
122
+ - spec/fixtures/multiple_posts.xml
123
+ - spec/fixtures/no_posts.xml
124
+ - spec/fixtures/single_post.xml
162
125
  - spec/helper.rb
163
126
  - spec/pinboard/client_spec.rb
164
127
  - spec/pinboard/post_spec.rb
165
128
  - spec/pinboard_spec.rb
166
129
  homepage: http://github.com/ryw/pinboard
167
130
  licenses: []
168
-
169
131
  post_install_message:
170
132
  rdoc_options: []
171
-
172
- require_paths:
133
+ require_paths:
173
134
  - lib
174
- required_ruby_version: !ruby/object:Gem::Requirement
135
+ required_ruby_version: !ruby/object:Gem::Requirement
175
136
  none: false
176
- requirements:
177
- - - ">="
178
- - !ruby/object:Gem::Version
179
- hash: 3
180
- segments:
181
- - 0
182
- version: "0"
183
- required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
142
  none: false
185
- requirements:
186
- - - ">="
187
- - !ruby/object:Gem::Version
188
- hash: 23
189
- segments:
190
- - 1
191
- - 3
192
- - 6
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
193
146
  version: 1.3.6
194
147
  requirements: []
195
-
196
148
  rubyforge_project:
197
- rubygems_version: 1.8.9
149
+ rubygems_version: 1.8.10
198
150
  signing_key:
199
151
  specification_version: 3
200
152
  summary: Ruby wrapper for the Pinboard API
201
- test_files:
202
- - spec/fixtures/posts_all.xml
153
+ test_files:
154
+ - spec/fixtures/multiple_posts.xml
155
+ - spec/fixtures/no_posts.xml
156
+ - spec/fixtures/single_post.xml
203
157
  - spec/helper.rb
204
158
  - spec/pinboard/client_spec.rb
205
159
  - spec/pinboard/post_spec.rb
206
160
  - spec/pinboard_spec.rb
161
+ has_rdoc: