plurky 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/plurky/api/timeline.rb +14 -11
- data/lib/plurky/client.rb +1 -1
- data/lib/plurky/version.rb +1 -1
- data/spec/fixtures/update.json +1 -0
- data/spec/plurky/api/timeline_spec.rb +19 -1
- data/spec/spec_helper.rb +8 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affb4e7ec7a48a10738ad091a74854036152f2c1
|
4
|
+
data.tar.gz: da49cd20f548798bad06215c03233d2a02263471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07365e2b2057b6e5bf220d8a62ff1db54456eca470732f881a02cdc4cb485b9daff18242157a76216148e26ccbfbc2ffde5157aecdd0511ec058fcabd25fbf4c
|
7
|
+
data.tar.gz: fee12dc511e6387c2e154b626b694f42ac80b35638911c24d5ce69d0478332c7c5eb2f796a4419398d80a054e0f1fe1f37041b4a50f65fec678ec4b714f089dc
|
data/README.md
CHANGED
data/lib/plurky/api/timeline.rb
CHANGED
@@ -6,21 +6,24 @@ module Plurky
|
|
6
6
|
# @see http://www.plurk.com/API#/APP/Timeline/getPlurk
|
7
7
|
# @return [Hashie::Mash] The requested status.
|
8
8
|
# @param id [Integer] A status ID.
|
9
|
+
# @param options [Hash] A customizable set of options.
|
9
10
|
# @example Return the status with the ID 1001647781
|
10
11
|
# Plurky.status(1001647781)
|
11
|
-
def status(id)
|
12
|
-
|
12
|
+
def status(id, options = {})
|
13
|
+
get("/APP/Timeline/getPlurk", options.merge(:plurk_id => id))
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
# @
|
18
|
-
# @
|
19
|
-
# @param
|
20
|
-
# @
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
# Updates the authenticating user's status
|
17
|
+
#
|
18
|
+
# @see http://www.plurk.com/API#/APP/Timeline/plurkAdd
|
19
|
+
# @return [Hashie::Mash] The created status.
|
20
|
+
# @param content [String] The content of the status update, up to 140 characters.
|
21
|
+
# @param qualifier [String] The qualifier of the status update.
|
22
|
+
# @param options [Hash] A customizable set of options.
|
23
|
+
# @example Update the authenticating user's status
|
24
|
+
# Plurky.update("I'm plurking with Plurky!", "says")
|
25
|
+
def update(content, qualifier, options = {})
|
26
|
+
post("/APP/Timeline/plurkAdd", options.merge(:content => content, :qualifier => qualifier))
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
data/lib/plurky/client.rb
CHANGED
data/lib/plurky/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"replurkers": [], "responses_seen": 0, "qualifier": "says", "replurkers_count": 0, "plurk_id": 1132701414, "response_count": 0, "anonymous": false, "replurkable": true, "limited_to": null, "favorite_count": 0, "is_unread": 0, "lang": "en", "favorers": [], "content_raw": "I'm plurking with Plurky!", "user_id": 5621917, "plurk_type": 0, "replurked": false, "favorite": false, "no_comments": 0, "content": "I'm plurking with Plurky!", "replurker_id": null, "posted": "Sun, 09 Jun 2013 14:37:02 GMT", "owner_id": 5621917}
|
@@ -17,7 +17,25 @@ describe Plurky::API::Timeline do
|
|
17
17
|
it "returns a correct Hashie::Mash" do
|
18
18
|
status = client.status(1001647781)
|
19
19
|
expect(status).to be_a Hashie::Mash
|
20
|
-
expect(status.content_raw).to eq "http://ridiculousfish.com/shell/index.html (Finally, a command line shell for the 90s) http://emos.plurk.com/b6ebb0a088fa352ee03ed6f760fb319d_w16_h16.png"
|
20
|
+
expect(status.plurk.content_raw).to eq "http://ridiculousfish.com/shell/index.html (Finally, a command line shell for the 90s) http://emos.plurk.com/b6ebb0a088fa352ee03ed6f760fb319d_w16_h16.png"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#update" do
|
25
|
+
before do
|
26
|
+
stub_post("/APP/Timeline/plurkAdd", :content => "I'm plurking with Plurky!", :qualifier => "says").
|
27
|
+
to_return(json_response("update.json"))
|
28
|
+
end
|
29
|
+
|
30
|
+
it "requests the correct resource" do
|
31
|
+
client.update("I'm plurking with Plurky!", "says")
|
32
|
+
expect(a_post("/APP/Timeline/plurkAdd", :content => "I'm plurking with Plurky!", :qualifier => "says")).to have_been_made
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns a correct Hashie::Mash" do
|
36
|
+
status = client.update("I'm plurking with Plurky!", "says")
|
37
|
+
expect(status).to be_a Hashie::Mash
|
38
|
+
expect(status.content_raw).to eq "I'm plurking with Plurky!"
|
21
39
|
end
|
22
40
|
end
|
23
41
|
|
data/spec/spec_helper.rb
CHANGED
@@ -20,10 +20,18 @@ def a_get(path, query = {})
|
|
20
20
|
a_request(:get, plurk_url(path)).with(:query => query)
|
21
21
|
end
|
22
22
|
|
23
|
+
def a_post(path, data = {})
|
24
|
+
a_request(:post, plurk_url(path)).with(:body => data)
|
25
|
+
end
|
26
|
+
|
23
27
|
def stub_get(path, query = {})
|
24
28
|
stub_request(:get, plurk_url(path)).with(:query => query)
|
25
29
|
end
|
26
30
|
|
31
|
+
def stub_post(path, data = {})
|
32
|
+
stub_request(:post, plurk_url(path)).with(:body => data)
|
33
|
+
end
|
34
|
+
|
27
35
|
def fixtures_path
|
28
36
|
File.expand_path("../fixtures", __FILE__)
|
29
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plurky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chun-wei Kuo
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- lib/plurky/version.rb
|
163
163
|
- plurky.gemspec
|
164
164
|
- spec/fixtures/status.json
|
165
|
+
- spec/fixtures/update.json
|
165
166
|
- spec/plurky/api/timeline_spec.rb
|
166
167
|
- spec/plurky/client_spec.rb
|
167
168
|
- spec/plurky_spec.rb
|
@@ -191,6 +192,7 @@ specification_version: 4
|
|
191
192
|
summary: Yet another Plurk API wrapper
|
192
193
|
test_files:
|
193
194
|
- spec/fixtures/status.json
|
195
|
+
- spec/fixtures/update.json
|
194
196
|
- spec/plurky/api/timeline_spec.rb
|
195
197
|
- spec/plurky/client_spec.rb
|
196
198
|
- spec/plurky_spec.rb
|