class TelphinApi::Method
An API
method. It is responsible for generating it's full name and determining it's type.
Constants
- PREDICATE_NAMES
A pattern for names of methods with a boolean result.
Public Instance Methods
call(args = {}, &block)
click to toggle source
Calling the API
method. It delegates the network request to `API.call` and result processing to `Result.process`. @param [Hash] args Arguments for the API
method.
# File lib/telphin_api/method.rb, line 12 def call(args = {}, &block) response = API.call(full_method, args, token) Result.process(response, type, block) end
Private Instance Methods
camelize(name)
click to toggle source
full_method()
click to toggle source
# File lib/telphin_api/method.rb, line 18 def full_method [@previous_resolver.name, @name].compact.map { |part| camelize(part).gsub(/[^A-Za-z.]/, '') } end
type()
click to toggle source
# File lib/telphin_api/method.rb, line 22 def type @name =~ PREDICATE_NAMES ? :boolean : :anything end