Class: ToNetMeApi::Method

Inherits:
Object
  • Object
show all
Includes:
Resolvable
Defined in:
lib/to_net_me_api/method.rb

Overview

An API method. It is responsible for generating it’s full name and determining it’s type.

Constant Summary collapse

PREDICATE_NAMES =

A pattern for names of methods with a boolean result.

/^is.*\?$/

Instance Attribute Summary

Attributes included from Resolvable

#name

Instance Method Summary collapse

Methods included from Resolvable

#auth_key, #initialize

Instance Method Details

#call(args = {}, &block) ⇒ Object

Calling the API method. It delegates the network request to ‘API.call` and result processing to `Result.process`.

Parameters:

  • args (Hash) (defaults to: {})

    Arguments for the API method.



12
13
14
15
16
17
# File 'lib/to_net_me_api/method.rb', line 12

def call(args = {}, &block)
  # raise full_name.inspect
  response = API.call(full_name, args, auth_key)
  # когда ответ бует стандартизирован тогда нужно будет делать вывод результата иобработку ошибок
  Result.process(response, type, block)
end