Class: PsnApiAr::Client
- Inherits:
-
Object
- Object
- PsnApiAr::Client
- Defined in:
- lib/psn_api_ar.rb
Instance Method Summary collapse
- #get_game(username, game_id) ⇒ Object
- #get_games(username) ⇒ Object
- #get_list_games(game_id) ⇒ Object
- #get_number_list_games ⇒ Object
- #get_psnid(username) ⇒ Object
- #get_trophies(username, game_id) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/psn_api_ar.rb', line 7 def initialize @url_base = "http://www.psnapi.com.ar/ps3/api/psn.asmx" end |
Instance Method Details
#get_game(username, game_id) ⇒ Object
11 12 13 14 |
# File 'lib/psn_api_ar.rb', line 11 def get_game(username, game_id) doc = Nokogiri::XML(open("#{@url_base}/getGame?sPSNID=#{username}&sIdGame=#{game_id}")) Nori.parse(doc.to_s) end |
#get_games(username) ⇒ Object
16 17 18 19 |
# File 'lib/psn_api_ar.rb', line 16 def get_games(username) doc = Nokogiri::XML(open("#{@url_base}/getGames?sPSNID=#{username}")) Nori.parse(doc.to_s)["ArrayOfGame"]["Game"] end |
#get_list_games(game_id) ⇒ Object
21 22 23 24 |
# File 'lib/psn_api_ar.rb', line 21 def get_list_games(game_id) doc = Nokogiri::XML(open("#{@url_base}/getListGames?sGameId=#{game_id}")) Nori.parse(doc.to_s)["ArrayOfGame"]["Game"] end |
#get_number_list_games ⇒ Object
26 27 28 29 |
# File 'lib/psn_api_ar.rb', line 26 def get_number_list_games doc = Nokogiri::XML(open("#{@url_base}/getNumberListGames?")) Nori.parse(doc.to_s)["int"] end |
#get_psnid(username) ⇒ Object
31 32 33 34 |
# File 'lib/psn_api_ar.rb', line 31 def get_psnid(username) doc = Nokogiri::XML(open("#{@url_base}/getPSNID?sPSNID=#{username}")) Nori.parse(doc.to_s)["PSNId"] end |
#get_trophies(username, game_id) ⇒ Object
36 37 38 39 |
# File 'lib/psn_api_ar.rb', line 36 def get_trophies(username, game_id) doc = Nokogiri::XML(open("#{@url_base}/getTrophies?sPSNID=#{username}&sGameId=#{game_id}")) Nori.parse(doc.to_s)["ArrayOfTrophy"]["Trophy"] end |