Skip to content

Commit 126f450

Browse files
committed
Add FC, LS, and PVP Team endpoints
Also updates the underscore logic to fix the casing for PvPTeam.
1 parent f1356ca commit 126f450

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lib/xivapi/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def objectify(response)
6565
end
6666

6767
def underscore(key)
68-
key.gsub(/([a-z\d])([A-Z])/,'\1_\2').gsub('.', '_').downcase
68+
key.gsub('PvPTeam', 'PvpTeam').gsub(/([a-z\d])([A-Z])/,'\1_\2').gsub('.', '_').downcase
6969
end
7070
end
7171
end

lib/xivapi/request.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,37 @@ def character_update(id: nil)
5151
def character_verified?(id: nil)
5252
request(self, "character/#{id}/verification").verification_token_pass
5353
end
54+
55+
# FreeCompany
56+
def free_company(id: nil, members: false, poll: false, columns: [])
57+
params = { data: members ? 'FCM' : nil, columns: [*columns].join(',') }
58+
request_cached(self, "freecompany/#{id}", :free_company, params, poll)
59+
end
60+
61+
def free_company_search(name: nil, server: nil, columns: [])
62+
params = { name: name, server: server&.capitalize, columns: [*columns].join(',') }
63+
XIVAPI::Paginator.new(self, params, 'freecompany/search', LODESTONE_LIMIT)
64+
end
65+
66+
# Linkshell
67+
def linkshell(id: nil, poll: false, columns: [])
68+
params = { columns: [*columns].join(',') }
69+
request_cached(self, "linkshell/#{id}", :linkshell, params, poll)
70+
end
71+
72+
def linkshell_search(name: nil, server: nil, columns: [])
73+
params = { name: name, server: server&.capitalize, columns: [*columns].join(',') }
74+
XIVAPI::Paginator.new(self, params, 'linkshell/search', LODESTONE_LIMIT)
75+
end
76+
77+
# PvPTeam
78+
def pvp_team(id: nil, poll: false, columns: [])
79+
params = { columns: [*columns].join(',') }
80+
request_cached(self, "pvpteam/#{id}", :pvp_team, params, poll)
81+
end
82+
83+
def pvp_team_search(name: nil, server: nil, columns: [])
84+
params = { name: name, server: server&.capitalize, columns: [*columns].join(',') }
85+
XIVAPI::Paginator.new(self, params, 'pvpteam/search', LODESTONE_LIMIT)
86+
end
5487
end

0 commit comments

Comments
 (0)