5 // Created by Hori,Masaki on 2017/02/24.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 fileprivate enum BasicAPI: String {
13 case getMemberBasic = "/kcsapi/api_get_member/basic"
14 case port = "/kcsapi/api_port/port"
17 fileprivate func dataKeys(_ apiResponse: APIResponse) -> [String] {
19 guard let basicApi = BasicAPI(rawValue: apiResponse.api)
20 else { return ["api_data"] }
23 case .port: return ["api_data", "api_basic"]
25 default: return ["api_data"]
29 final class BasicMapper: JSONMapper {
31 typealias ObjectType = Basic
33 let apiResponse: APIResponse
34 let configuration: MappingConfiguration<Basic>
36 required init(_ apiResponse: APIResponse) {
38 self.apiResponse = apiResponse
39 self.configuration = MappingConfiguration(entity: Basic.entity,
40 dataKeys: dataKeys(apiResponse),
41 editorStore: ServerDataStore.oneTimeEditor())
46 let store = ServerDataStore.oneTimeEditor()
48 guard let basic = store.basic() ?? store.createBasic()
49 else { return print("Can not Get Basic") }
51 registerElement(data, to: basic)