Sha256: 1b1bc4debf52db21accc05ee17431e91e05cbf34cadf908f6bdce2869b33917a

Contents?: true

Size: 650 Bytes

Versions: 8

Compression:

Stored size: 650 Bytes

Contents

module WialonApi
  # An API method. It is responsible for generating it's full name and determining it's type.
  class Method
    include Resolvable

    # A pattern for names of methods with a boolean result.
    PREDICATE_NAMES = /^is.*\?$/

    # 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.
    def call(args = {}, &block)
      response = Api.call(full_name, args, sid)
      Result.process(response, block)
    end

    private

    def full_name
      [@previous_resolver.name, @name].join('/')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wialon_api-0.0.8 lib/wialon_api/method.rb
wialon_api-0.0.7 lib/wialon_api/method.rb
wialon_api-0.0.6 lib/wialon_api/method.rb
wialon_api-0.0.5 lib/wialon_api/method.rb
wialon_api-0.0.4 lib/wialon_api/method.rb
wialon_api-0.0.3 lib/wialon_api/method.rb
wialon_api-0.0.2 lib/wialon_api/method.rb
wialon_api-0.0.1 lib/wialon_api/method.rb