Skip to content

Commit

Permalink
single_post method to return one piece of media from vine
Browse files Browse the repository at this point in the history
  • Loading branch information
stakes committed Nov 22, 2013
1 parent 4a20f9c commit 26201d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/redvine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def user_timeline(uid, opts={})
get_request_data('timelines/users/' + uid, opts)
end

def single_post(pid)
raise(ArgumentError, 'You must specify a post id') if !pid
response = get_request_data('/timelines/posts/' + pid)
return response.kind_of?(Array) ? response.first : response
end


private
def validate_connect_args(opts={})
Expand All @@ -69,6 +75,7 @@ def get_request_data(endpoint, query={}, records=true)
args = {:headers => session_headers}
args.merge!(:query => query) if query != {}
response = HTTParty.get(@@baseUrl + endpoint, args).parsed_response
return Hashie::Mash.new(JSON.parse('{"success": false}')) if response.kind_of?(String)
if response['success'] == false
response['error'] = true
return Hashie::Mash.new(response)
Expand Down

0 comments on commit 26201d7

Please sign in to comment.