2 // NyukyoDockMapper.swift
5 // Created by Hori,Masaki on 2017/02/24.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 fileprivate enum DeckAPI: String {
12 case getMemberNDock = "/kcsapi/api_get_member/ndock"
13 case port = "/kcsapi/api_port/port"
16 fileprivate func dataKey(_ apiResponse: APIResponse) -> String {
17 guard let deckApi = DeckAPI(rawValue: apiResponse.api)
18 else { return "api_data" }
20 case .port: return "api_data.api_ndock"
21 default: return "api_data"
25 class NyukyoDockMapper: JSONMapper {
26 let apiResponse: APIResponse
27 let configuration: MappingConfiguration
29 required init(_ apiResponse: APIResponse) {
30 self.apiResponse = apiResponse
31 self.configuration = MappingConfiguration(entityType: NyukyoDock.self,
32 dataKey: dataKey(apiResponse),
33 editorStore: ServerDataStore.oneTimeEditor())