Module: Jat::Plugins::SimpleApi

Defined in:
lib/jat/plugins/simple_api/lib/map.rb,
lib/jat/plugins/simple_api/simple_api.rb,
lib/jat/plugins/simple_api/lib/response.rb,
lib/jat/plugins/simple_api/lib/response_piece.rb,
lib/jat/plugins/simple_api/lib/fields_param_parser.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: FieldsParamParser, Map, Response, ResponsePiece

Class Method Summary collapse

Class Method Details

.after_load(jat_class, **_opts) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/jat/plugins/simple_api/simple_api.rb', line 27

def self.after_load(jat_class, **_opts)
  jat_class.config[:response_plugin_loaded] = plugin_name

  jat_class.meta_key(:meta)

  fields_parser_class = Class.new(FieldsParamParser)
  fields_parser_class.jat_class = jat_class
  jat_class.const_set(:FieldsParamParser, fields_parser_class)

  map_class = Class.new(Map)
  map_class.jat_class = jat_class
  jat_class.const_set(:Map, map_class)

  response_class = Class.new(Response)
  response_class.jat_class = jat_class
  jat_class.const_set(:Response, response_class)

  response_piece_class = Class.new(ResponsePiece)
  response_piece_class.jat_class = jat_class
  jat_class.const_set(:ResponsePiece, response_piece_class)
end

.before_load(jat_class, **_opts) ⇒ Object

Raises:



15
16
17
18
19
20
# File 'lib/jat/plugins/simple_api/simple_api.rb', line 15

def self.before_load(jat_class, **_opts)
  response_plugin = jat_class.config[:response_plugin_loaded]
  return unless response_plugin

  raise Error, "Response plugin `#{response_plugin}` was already loaded before"
end

.load(jat_class, **_opts) ⇒ Object



22
23
24
25
# File 'lib/jat/plugins/simple_api/simple_api.rb', line 22

def self.load(jat_class, **_opts)
  jat_class.include(InstanceMethods)
  jat_class.extend(ClassMethods)
end

.plugin_nameObject



11
12
13
# File 'lib/jat/plugins/simple_api/simple_api.rb', line 11

def self.plugin_name
  :simple_api
end