Sha256: ef25e1c87aa22e8e85f0f7434f27c9263c9242b46cc275f24843c76d401534bf

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

module WialonApi
  class Client
    include WialonApi::Resolver

    attr_reader :sid, :info

    def initialize(sid = nil, info = {})
      @sid = sid
      @info = info
    end

    def authorized?
      !@sid.nil?
    end

    def execute(*args)
      call_method(*args)
    end

    # If the called method is a namespace, it creates and returns a new `WialonApi::Namespace` instance.
    # Otherwise it creates a `WialonApi::Method` instance and calls it passing the arguments and a block.
    def method_missing(*args, &block)
      if Namespace.exists?(args.first)
        create_namespace(args.first)
      else
        call_method(args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wialon_api-0.0.8 lib/wialon_api/client.rb