Class: TochkaCyclopsApi::Methods

Inherits:
Object
  • Object
show all
Defined in:
lib/tochka_cyclops_api/methods.rb

Constant Summary collapse

METHODS =
%w[
  echo
  create_beneficiary_ul
  create_beneficiary_ip
  create_beneficiary_fl
  update_beneficiary_ul
  update_beneficiary_ip
  update_beneficiary_fl
  get_beneficiary
  list_beneficiary
  activate_beneficiary
  deactivate_beneficiary
]
DIVIDER =
["\n", "="*80, "\n"]

Class Method Summary collapse

Class Method Details

.get_method(method) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/tochka_cyclops_api/methods.rb', line 84

def self.get_method(method)
  return unless method_exists? method

  require_relative "schemas/requests/#{method}"

  @method = method

  define_schema_class
  define_schema_ast
  parse_schema_ast
  @formatted_schema_ast = format_schema_ast
  show_schema

  puts @method.split('_').map(&:capitalize).join
  puts @formatted_schema_ast
  puts DIVIDER
  puts ['EXAMPLE', "\n"]
  puts @schema_class.const_get('EXAMPLE')
end