Class: Apiwork::Export::ApiworkMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/apiwork/export/apiwork_mapper.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(export) ⇒ ApiworkMapper

Returns a new instance of ApiworkMapper.



12
13
14
# File 'lib/apiwork/export/apiwork_mapper.rb', line 12

def initialize(export)
  @export = export
end

Class Method Details

.map(export, surface) ⇒ Object



7
8
9
# File 'lib/apiwork/export/apiwork_mapper.rb', line 7

def map(export, surface)
  new(export).map(surface)
end

Instance Method Details

#map(surface) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/apiwork/export/apiwork_mapper.rb', line 16

def map(surface)
  {
    base_path: @export.api.base_path,
    enums: serialize_enums(surface.enums),
    error_codes: serialize_error_codes,
    fingerprint: @export.api.fingerprint,
    info: serialize_info,
    locales: @export.api.locales.map(&:to_s),
    resources: serialize_resources(@export.api.resources),
    types: serialize_types(surface.types),
  }
end