-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the status API of getting a plurk
- Loading branch information
Showing
9 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'plurky/api/timeline' | ||
|
||
module Plurky | ||
module API | ||
include Plurky::API::Timeline | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Plurky | ||
module API | ||
module Timeline | ||
# Returns a status | ||
# | ||
# @see http://www.plurk.com/API#/APP/Timeline/getPlurk | ||
# @return [Hashie::Mash] The requested status. | ||
# @param id [Integer] A status ID. | ||
# @example Return the status with the ID 1001647781 | ||
# Plurky.status(1001647781) | ||
def status(id) | ||
object_from_response(:get, "/APP/Timeline/getPlurk", { :plurk_id => id }).plurk | ||
end | ||
|
||
private | ||
|
||
# @param method [Symbol] | ||
# @param url [String] | ||
# @param params [Hash] | ||
# @return [Hashie::Mash] | ||
def object_from_response(method, url, params = {}) | ||
response = send(method, url, params) | ||
response[:body] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"plurk_users": {"1": {"verified_account": false, "default_lang": "en", "display_name": "amix", "dateformat": 0, "nick_name": "amix", "has_profile_image": 1, "location": "", "bday_privacy": 2, "date_of_birth": "Mon, 13 May 1985 00:01:00 GMT", "karma": 69.6, "full_name": "Amir Salihefendic", "gender": 1, "name_color": "0A9C17", "timezone": "Europe\/Amsterdam", "id": 1, "avatar": 34}}, "user": {"verified_account": false, "default_lang": "en", "display_name": "amix", "dateformat": 0, "nick_name": "amix", "has_profile_image": 1, "location": "", "bday_privacy": 2, "date_of_birth": "Mon, 13 May 1985 00:01:00 GMT", "karma": 69.6, "full_name": "Amir Salihefendic", "gender": 1, "name_color": "0A9C17", "timezone": "Europe\/Amsterdam", "id": 1, "avatar": 34}, "plurk": {"replurkers_count": 4, "replurkable": true, "favorite_count": 6, "is_unread": 0, "favorers": [24228, 89434, 3184175, 3633219, 5386772, 6693159], "user_id": 1, "plurk_type": 0, "replurked": false, "content": "<a href=\"http:\/\/ridiculousfish.com\/shell\/index.html\" class=\"ex_link\" rel=\"nofollow\">Finally, a command line shell for the 90s<\/a> <img class=\"emoticon_my\" src=\"http:\/\/emos.plurk.com\/b6ebb0a088fa352ee03ed6f760fb319d_w16_h16.png\" width=\"16\" height=\"16\" \/>", "replurker_id": null, "owner_id": 1, "responses_seen": 0, "qualifier": "likes", "plurk_id": 1001647781, "response_count": 8, "limited_to": null, "no_comments": 0, "posted": "Wed, 06 Jun 2012 12:37:42 GMT", "lang": "en", "content_raw": "http:\/\/ridiculousfish.com\/shell\/index.html (Finally, a command line shell for the 90s) http:\/\/emos.plurk.com\/b6ebb0a088fa352ee03ed6f760fb319d_w16_h16.png", "replurkers": [23118, 3184175, 4853404, 6649986], "favorite": true}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
describe Plurky::API::Timeline do | ||
subject(:client) { Plurky::Client.new } | ||
|
||
describe "#status" do | ||
before do | ||
stub_get("/APP/Timeline/getPlurk", :plurk_id => 1001647781). | ||
to_return(json_response("status.json")) | ||
end | ||
|
||
it "requests the correct resource" do | ||
client.status(1001647781) | ||
expect(a_get("/APP/Timeline/getPlurk", :plurk_id => 1001647781)).to have_been_made | ||
end | ||
|
||
it "returns a correct Hashie::Mash" do | ||
status = client.status(1001647781) | ||
expect(status).to be_a Hashie::Mash | ||
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" | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,7 @@ | |
end | ||
end | ||
|
||
describe ".configure" do | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters