Module: Reach::API::File

Included in:
Reach::API
Defined in:
lib/reach/api/file.rb

Instance Method Summary collapse

Instance Method Details

#get_file_details(id) ⇒ Object

Public: Fetches information on a specific file

id - the ID of the file to get information on

Returns a hash



23
24
25
26
27
# File 'lib/reach/api/file.rb', line 23

def get_file_details(id)
  uri = ENDPOINT + "file/details/#{key}/#{id}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#get_player_file_set_files(gamertag, id) ⇒ Object

Public: Fetches a list of files in a player’s file set

gamertag - the specified player id - the fileset ID

Returns a hash



61
62
63
64
65
66
# File 'lib/reach/api/file.rb', line 61

def get_player_file_set_files(gamertag, id)
  gamertag = gamertag.gsub(' ', '%20')
  uri = ENDPOINT + "file/sets/files/#{key}/#{gamertag}/#{id}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#get_player_file_sets(gamertag) ⇒ Object

Public: Fetches a list of file sets belonging to a player

gamertag - the player to get a list of file sets for

Returns a hash



47
48
49
50
51
52
# File 'lib/reach/api/file.rb', line 47

def get_player_file_sets(gamertag)
  gamertag = gamertag.gsub(' ', '%20')
  uri = ENDPOINT + "file/sets/#{key}/#{gamertag}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#get_player_file_share(gamertag) ⇒ Object

Public: Fetches a listing of files in a player’s file share

gamertag - the player to get a file listing for

Returns a hash



11
12
13
14
15
16
# File 'lib/reach/api/file.rb', line 11

def get_player_file_share(gamertag)
  gamertag = gamertag.gsub(' ', '%20')
  uri = ENDPOINT + "file/share/#{key}/#{gamertag}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#get_player_recent_screenshots(gamertag) ⇒ Object

Public: Fetches a list of a player’s recent screenshots

gamertag - the specified player

Returns a hash



34
35
36
37
38
39
# File 'lib/reach/api/file.rb', line 34

def get_player_recent_screenshots(gamertag)
  gamertag = gamertag.gsub(' ', '%20')
  uri = ENDPOINT + "file/screenshots/#{key}/#{gamertag}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#get_player_rendered_videos(gamertag, page = 0) ⇒ Object

Public: Fetches a list of rendered videos belonging to a player

gamertag - the specified player page - an optional page of results to fetch

Returns a hash



75
76
77
78
79
80
# File 'lib/reach/api/file.rb', line 75

def get_player_rendered_videos(gamertag, page = 0)
  gamertag = gamertag.gsub(' ', '%20')
  uri = ENDPOINT + "file/videos/#{key}/#{gamertag}/#{page}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end

#reach_file_search(file_category, map_filter, engine_filter, date_filter, sort_filter, tags = '', page = 0) ⇒ Object

Public: Fetches a listing of files matching search criteria

file_category - the type of file to search for map_filter - an map to limit results engine_filter - an game engine type to limit results date_filter - a required date filter sort_filter - a required sort parameter tags - a semicolon-delimited list of tags to search for page - the page of results to fetch

Returns a hash containing search results



93
94
95
96
97
# File 'lib/reach/api/file.rb', line 93

def reach_file_search(file_category, map_filter, engine_filter, date_filter, sort_filter, tags = '', page = 0)
  uri = ENDPOINT + "file/search/#{key}/#{file_category}/#{map_filter}/#{engine_filter}/#{date_filter}/#{sort_filter}/#{page}?tags=#{tags}"
  data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
  Reach::Helper::convert_keys(data)
end