Skip to content

Commit d2f6f2a

Browse files
committed
Add more granular data option for Character
Allows the user to specify the additional data individually instead of giving them all or nothing.
1 parent 672cb79 commit d2f6f2a

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
xivapi (0.2.3)
4+
xivapi (0.2.4)
55
rest-client (~> 2.0.2)
66

77
GEM

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A Ruby library for [XIVAPI](https://www.xivapi.com/).
77
Add this line to your application's Gemfile:
88

99
```ruby
10-
gem 'xivapi', git: 'https://github.com/xivapi/xivapi-ruby.git', tag: 'v0.2.3'
10+
gem 'xivapi', git: 'https://github.com/xivapi/xivapi-ruby.git', tag: 'v0.2.4'
1111
```
1212

1313
And then run:

lib/xivapi/request.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,17 @@ def market_categories
9090
# @param id [Integer] Character ID
9191
# @param all_data [true, false] Return the full set of character data
9292
# @param poll [true, false] Continuously call the API until a result is cached and returned
93+
# @param data [String, Array <String>] Additional data to request, see: https://xivapi.com/docs/Character#character
9394
# @param columns [String, Array <String>] One or more columns to limit results to
9495
# @return [OpenStruct] The requested character
95-
def character(id: nil, all_data: false, poll: false, columns: [])
96-
params = { data: all_data ? ALL_CHARACTER_DATA : nil, columns: [*columns].join(',') }
96+
def character(id: nil, all_data: false, poll: false, data: [], columns: [])
97+
if all_data
98+
data = ALL_CHARACTER_DATA
99+
else
100+
data = [*data].join(',')
101+
end
102+
103+
params = { data: data, columns: [*columns].join(',') }
97104
request_cached(self, "character/#{id}", :character, params, poll)
98105
end
99106

lib/xivapi/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module XIVAPI
22
# Gem version
3-
VERSION = "0.2.3"
3+
VERSION = "0.2.4"
44
end

0 commit comments

Comments
 (0)