Sha256: 679f95b1a47e2e4c9db7f594597d61f097e195a79379b29861cb59314011a192
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'net/http' require 'multi_json' module Namba module APIMethods def get_user_info name = self.username get_responce_from "http://api.namba.#{self.locale}/getUserInfo.php?username=" + name end def get_user_video name = self.username get_responce_from "http://api.namba.#{self.locale}/getVideo.php?username=" + name end def get_user_photo name = self.username get_responce_from "http://api.namba.#{self.locale}/getPhoto.php?username=" + name end def get_friends_list name = self.username get_responce_from "http://api.namba.#{self.locale}/friends.php?username=" + name end def set_status text post_data_to "http://api.namba.#{self.locale}/setStatus.php", { username: self.username, password: self.password, status: text } end def get_events post_data_to "http://api.namba.#{self.locale}/getEvents.php" end def get_new_mail_count post_data_to "http://api.namba.#{self.locale}/getNewMailCount.php" end def get_last_mail post_data_to "http://api.namba.#{self.locale}/getLastMail.php" end private def get_responce_from url response = Net::HTTP.get_response(URI.parse(url)) MultiJson.decode(response.body) end def post_data_to url, params = { username: self.username, password: self.password } response = Net::HTTP.post_form(URI.parse(url), params) MultiJson.decode(response.body) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
namba-1.0.0 | lib/namba/api_methods.rb |
namba-0.0.1 | lib/namba/api_methods.rb |