admiral_stats_parser 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 572b0cd0b486cfa4acb50b5a15b06dcab604518c
4
- data.tar.gz: 6171b97706b880ef9845d196de953bf22c851f39
3
+ metadata.gz: f8b909d1d3cec6dc0f41925980ca45af971cf346
4
+ data.tar.gz: a008b2b774371dde2b60a5951520c5c3a873d3d3
5
5
  SHA512:
6
- metadata.gz: 785ef0bd1d6edbb9de1f7a602ee662be850433761fc170976dc713dc62876fadf696bc053bea2ab2f994b5eb384670e0a1a54750884fe1beb35358510dea5058
7
- data.tar.gz: 20a1a6a02b924c85ea298782d578461a3e55b93511a70d39bea2d3a1c9759a289e8895d1c29c3c20f4c6e240356c4e079c361e3ad6e7c0e7eea9932eb6cf577c
6
+ metadata.gz: b06be04b39eb529ad4d6d2fa3498ffc666bd9d118f545b095ad7853f371d2e962b839ca839f7907dc81e6057d938e037adbc259dcf78591f00422e0b05b66070
7
+ data.tar.gz: 0e4854f2c53a4aee6c9a448a9aa309cb2c1ce9690e39761ff600a66fbccdcd12a54e4262e0eb4f5963d11c85076728ab1f7fa46e77808344e9a164287589f636
data/README.md CHANGED
@@ -68,7 +68,8 @@ AdmiralStatsParser は、以下の API version をサポートしています。
68
68
  | 10 | 2017-09-21 〜 2018-01-31 |
69
69
  | 11 | 2018-02-01 (VERSION A REVISION 3 のリリース日) 〜 2018-02-15 |
70
70
  | 12 | 2018-02-16 (ケッコンカッコカリの実装日) 〜 2018-04-18 |
71
- | 13 | 2018-04-19 (第4回イベントの EO 開始日) 〜 |
71
+ | 13 | 2018-04-19 (第4回イベントの EO 開始日) 〜 2018-05-13 |
72
+ | 14 | 2018-05-14 (大型艦建造の実装日) 〜 |
72
73
 
73
74
  各 API version でパースできる JSON の種類は以下の通りです。また、同じ情報でも、API version によって、含まれる情報量が異なる場合があります。その場合は Supported (1), Supported (2) のように記載して区別しています。
74
75
 
@@ -78,7 +79,7 @@ AdmiralStatsParser は、以下の API version をサポートしています。
78
79
  | 2 〜 6 | Supported (2) | Supported (2) | Supported (2) | Supported |
79
80
  | 7 〜 10 | Supported (3) | Supported (3) | Supported (2) | Supported |
80
81
  | 11 | Supported (3) | Supported (4) | Supported (2) | Supported |
81
- | 12 〜 13 | Supported (3) | Supported (4) | Supported (3) | Supported |
82
+ | 12 〜 14 | Supported (3) | Supported (4) | Supported (3) | Supported |
82
83
 
83
84
  | API version | 艦娘一覧 | 装備一覧 | イベント海域情報 |
84
85
  |------------:|:-----|:-----|:-----|
@@ -91,12 +92,13 @@ AdmiralStatsParser は、以下の API version をサポートしています。
91
92
  | 9 〜 11 | Supported (4) | Supported (2) | Supported (2) |
92
93
  | 12 | Supported (5) | Supported (2) | Supported (2) |
93
94
  | 13 | Supported (5) | Supported (2) | Supported (3) |
95
+ | 14 | Supported (6) | Supported (2) | Supported (3) |
94
96
 
95
97
  | API version | 改装設計図一覧 |
96
98
  |------------:|:-----|
97
99
  | 1 〜 6 | Unsupported |
98
100
  | 7 | Supported (1) |
99
- | 8 〜 13 | Supported (2) |
101
+ | 8 〜 14 | Supported (2) |
100
102
 
101
103
  ## Development
102
104
 
@@ -12,7 +12,7 @@ require 'admiral_stats_parser/parser/blueprint_list_info_parser'
12
12
  module AdmiralStatsParser
13
13
  # 最新の API バージョンを返します。
14
14
  def self.get_latest_api_version
15
- return 13
15
+ return 14
16
16
  end
17
17
 
18
18
  # エクスポート時刻を元に、API バージョンを推測して返します。
@@ -53,6 +53,9 @@ module AdmiralStatsParser
53
53
  # version 13 の開始日
54
54
  return 12 if exported_at < Time.parse('2018-04-19T07:00:00+0900')
55
55
 
56
+ # version 14 の開始日
57
+ return 13 if exported_at < Time.parse('2018-05-14T07:00:00+0900')
58
+
56
59
  return self.get_latest_api_version
57
60
  end
58
61
 
@@ -63,7 +66,7 @@ module AdmiralStatsParser
63
66
  PersonalBasicInfoParser.parse(json, 1)
64
67
  when 2..6
65
68
  PersonalBasicInfoParser.parse(json, 2)
66
- when 7..13
69
+ when 7..14
67
70
  PersonalBasicInfoParser.parse(json, 3)
68
71
  else
69
72
  raise 'unsupported API version'
@@ -79,7 +82,7 @@ module AdmiralStatsParser
79
82
  AreaCaptureInfoParser.parse(json, 2)
80
83
  when 7..10
81
84
  AreaCaptureInfoParser.parse(json, 3)
82
- when 11..13
85
+ when 11..14
83
86
  AreaCaptureInfoParser.parse(json, 4)
84
87
  else
85
88
  raise 'unsupported API version'
@@ -93,7 +96,7 @@ module AdmiralStatsParser
93
96
  TcBookInfoParser.parse(json, 1)
94
97
  when 2..11
95
98
  TcBookInfoParser.parse(json, 2)
96
- when 12..13
99
+ when 12..14
97
100
  TcBookInfoParser.parse(json, 3)
98
101
  else
99
102
  raise 'unsupported API version'
@@ -103,7 +106,7 @@ module AdmiralStatsParser
103
106
  # 装備図鑑をパースします。
104
107
  def self.parse_equip_book_info(json, api_version)
105
108
  case api_version
106
- when 1..13
109
+ when 1..14
107
110
  EquipBookInfoParser.parse(json)
108
111
  else
109
112
  raise 'unsupported API version'
@@ -125,6 +128,8 @@ module AdmiralStatsParser
125
128
  CharacterListInfoParser.parse(json, 4)
126
129
  when 12..13
127
130
  CharacterListInfoParser.parse(json, 5)
131
+ when 14
132
+ CharacterListInfoParser.parse(json, 6)
128
133
  else
129
134
  raise 'unsupported API version'
130
135
  end
@@ -137,7 +142,7 @@ module AdmiralStatsParser
137
142
  raise 'API version 1 does not support equip list info'
138
143
  when 2..8
139
144
  EquipListInfoParser.parse(json, 1)
140
- when 9..13
145
+ when 9..14
141
146
  EquipListInfoParser.parse(json, 2)
142
147
  else
143
148
  raise 'unsupported API version'
@@ -149,7 +154,7 @@ module AdmiralStatsParser
149
154
  case api_version
150
155
  when 1..8
151
156
  EquipListInfoParser.parse_max_slot_num(json, 1)
152
- when 9..13
157
+ when 9..14
153
158
  EquipListInfoParser.parse_max_slot_num(json, 2)
154
159
  else
155
160
  raise 'unsupported API version'
@@ -165,7 +170,7 @@ module AdmiralStatsParser
165
170
  EventInfoParser.parse(json, 1)
166
171
  when 7..12
167
172
  EventInfoParser.parse(json, 2)
168
- when 13
173
+ when 13..14
169
174
  EventInfoParser.parse(json, 3)
170
175
  else
171
176
  raise 'unsupported API version'
@@ -177,7 +182,7 @@ module AdmiralStatsParser
177
182
  case api_version
178
183
  when 1..3
179
184
  raise "API version #{api_version} does not support event info"
180
- when 4..13
185
+ when 4..14
181
186
  {
182
187
  opened: EventInfoParser.opened?(event_info_list, level, period),
183
188
  all_cleared: EventInfoParser.all_cleared?(event_info_list, level, period),
@@ -198,7 +203,7 @@ module AdmiralStatsParser
198
203
  raise "API version #{api_version} does not support blueprint list info"
199
204
  when 7
200
205
  BlueprintListInfoParser.parse(json, 1)
201
- when 8..13
206
+ when 8..14
202
207
  BlueprintListInfoParser.parse(json, 2)
203
208
  else
204
209
  raise 'unsupported API version'
@@ -91,6 +91,40 @@ class CharacterListInfoParser
91
91
  blueprint_total_num: Integer,
92
92
  married: :boolean,
93
93
  },
94
+ 6 => {
95
+ book_no: Integer,
96
+ lv: Integer,
97
+ ship_type: String,
98
+ ship_sort_no: Integer,
99
+ remodel_lv: Integer,
100
+ ship_name: String,
101
+ status_img: String,
102
+ star_num: Integer,
103
+ ship_class: String,
104
+ tc_img: String,
105
+ exp_percent: Integer,
106
+ max_hp: Integer,
107
+ real_hp: Integer,
108
+ damage_status: String,
109
+ slot_num: Integer,
110
+ slot_equip_name: Array,
111
+ slot_amount: Array,
112
+ slot_disp: Array,
113
+ slot_img: Array,
114
+ blueprint_total_num: Integer,
115
+ married: :boolean,
116
+ },
117
+ }
118
+
119
+ OPTIONAL_KEYS = {
120
+ 1 => {},
121
+ 2 => {},
122
+ 3 => {},
123
+ 4 => {},
124
+ 5 => {},
125
+ 6 => {
126
+ ship_class_index: Integer,
127
+ },
94
128
  }
95
129
 
96
130
  def self.parse(json, api_version)
@@ -125,6 +159,19 @@ class CharacterListInfoParser
125
159
  result.instance_variable_set("@#{key.to_s}", items[camel_case_key])
126
160
  end
127
161
 
162
+ OPTIONAL_KEYS[api_version].each do |key, key_class|
163
+ # キーが含まれなければ、処理をスキップ
164
+ camel_case_key = key.to_s.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
165
+ next unless items.include?(camel_case_key)
166
+
167
+ # 結果のクラスが合わなければエラー
168
+ unless items[camel_case_key].is_a?(key_class)
169
+ raise "Optional key #{key} is not class #{key_class}"
170
+ end
171
+
172
+ result.instance_variable_set("@#{key.to_s}", items[camel_case_key])
173
+ end
174
+
128
175
  results << result
129
176
  end
130
177
 
@@ -1,3 +1,3 @@
1
1
  module AdmiralStatsParser
2
- VERSION = '1.13.0'
2
+ VERSION = '1.14.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admiral_stats_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Yoshizawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-21 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler