lib/pupil/schemes.rb in pupil-0.6.3 vs lib/pupil/schemes.rb in pupil-0.7
- old
+ new
@@ -23,11 +23,11 @@
Pupil::Status.new(@element["status"], @access_token) rescue nil
end
def reply(sentence, status=nil)
response = self.post(
- "/1/statuses/update.json",
+ "statuses/update.json",
"status"=> "@#{@element[:screen_name]} #{sentence}",
"in_reply_to_status_id" => status
)
return response
end
@@ -42,97 +42,97 @@
end
def entities() Pupil::Entities.new(@element["entities"]) rescue nil; end
def destroy(param={})
- self.post("/1/statuses/destroy/#{@element["id"]}.json", param)
+ self.post("statuses/destroy/#{@element["id"]}.json", param)
end
alias_method :delete, :destroy
def retweet(param={})
- self.post("/1/statuses/retweet/#{@element["id"]}.json", param)
+ self.post("statuses/retweet/#{@element["id"]}.json", param)
end
def retweets(param={})
- response = self.get("/1/statuses/retweets/#{@element["id"]}.json", param)
+ response = self.get("statuses/retweets/#{@element["id"]}.json", param)
return false unless response
statuses = []
response.each do |status|
statuses << Pupil::Status.new(status, @access_token)
end
return statuses
end
def retweeted_by(param={})
- response = self.get("/1/statuses/#{@element["id"]}/retweeted_by.json", param)
+ response = self.get("statuses/#{@element["id"]}/retweeted_by.json", param)
return false unless response
users = []
response.each do |user|
users << Pupil::User.new(user, @access_token)
end
return users
end
def retweeted_by_user_ids(param={})
- response = self.get("/1/statuses/#{@element["id"]}/retweeted_by/ids.json", param)
+ response = self.get("statuses/#{@element["id"]}/retweeted_by/ids.json", param)
return false unless response
return response
end
end
class List < Scheme
def user() Pupil::User.new(@element["user"], @access_token) rescue nil; end
def statuses(param={})
- response = self.get("/1/lists/statuses.json", {:list_id => @element["id_str"]}.update(param))
+ response = self.get("lists/statuses.json", {:list_id => @element["id_str"]}.update(param))
return false unless response
statuses = []
response.each do |status|
statuses << Pupil::Status.new(status, @access_token)
end
return statuses
end
def subscribers(param={})
- response = self.get("/1/lists/subscribers.json", {:list_id => @element["id_str"]}.update(param))
+ response = self.get("lists/subscribers.json", {:list_id => @element["id_str"]}.update(param))
return false unless response
users = []
response["users"].each do |user|
users << Pupil::User.new(user, @access_token)
end
return users
end
def members(param={})
- response = self.get("/1/lists/members.json", {:list_id => @element["id_str"]}.update(param))
+ response = self.get("lists/members.json", {:list_id => @element["id_str"]}.update(param))
return false unless response
users = []
response["users"].each do |u|
user = User.new(u.update("_list_id" => @element["id_str"]), @access_token)
def user.destroy()
- response = self.post("/1/lists/members/destroy.json", {:list_id => @element["_list_id"], :user_id => @element["id_str"]})
+ response = self.post("lists/members/destroy.json", {:list_id => @element["_list_id"], :user_id => @element["id_str"]})
end
users << user
end
return users
end
def add(param)
- response = self.post("/1/lists/members/create.json", {:list_id => @element["id_str"], guess_parameter(param) => param})
+ response = self.post("lists/members/create.json", {:list_id => @element["id_str"], guess_parameter(param) => param})
return List.new(response)
end
def strike(param, opts={})
- response = self.post("/1/lists/members/destroy.json", {guess_parameter(param) => param, :list_id => @element["id_str"]}.update(opts))
+ response = self.post("lists/members/destroy.json", {guess_parameter(param) => param, :list_id => @element["id_str"]}.update(opts))
return response
end
alias_method :off, :strike
def destroy()
- response = self.post("/1/lists/destroy.json", {:list_id => @element["id_str"]})
+ response = self.post("lists/destroy.json", {:list_id => @element["id_str"]})
return List.new(response)
end
alias_method :delete, :destroy
end
@@ -180,10 +180,10 @@
# Delete direct message
# @param [Fixnum] dm_id message id that you want to delete
# @return [Hash] response
def destroy()
begin
- response = self.post("/1/direct_messages/destroy/#{@element["id"]}.json")
+ response = self.post("direct_messages/destroy/#{@element["id"]}.json")
rescue
return false
end
return response
end
\ No newline at end of file