Sha256: b1bf56d9edb490f0c720fe5b0ba443458611c88988e92930ed2b60ec2062bc16

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module UnifiProtect
  class Client
    attr_reader :api

    def initialize(api: nil, **args)
      @api = api || API.new(**args)
    end

    def bootstrap
      @bootstrap ||= api.bootstrap
    end

    def nvr
      @nvr ||= NVR.new(client: self, nvr: bootstrap.nvr)
    end

    def create_camera_objects
      bootstrap.cameras.map { |camera| Camera.new(client: self, camera: camera) }
    end

    def cameras
      @cameras ||= CameraCollection.new(create_camera_objects)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unifi_protect-0.1.0 lib/unifi_protect/client.rb