Sha256: cb1c54ffc6b5e2fea50cd3b96d70b60e7a7b549dcd5b371f8a1ffe92caf22c5c

Contents?: true

Size: 644 Bytes

Versions: 7

Compression:

Stored size: 644 Bytes

Contents

module WialonApi
  class Client
    include WialonApi::Resolver

    attr_reader :sid

    def initialize(sid = nil)
      @sid = sid
    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

7 entries across 7 versions & 1 rubygems

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