Sha256: ce523a24647389cfcd4176ca7603d2bdeb122a85b8f70a82eb34dcb01d159136

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module ZoomEye
  class API
    def initialize(username: ENV["ZOOMEYE_USERNAME"], password: ENV["ZOOMEYE_PASSWORD"])
      @username = username
      raise ArgumentError, "No usernamme has been found or provided!" unless @username

      @password = password
      raise ArgumentError, "No password has been found or provided!" unless @password
    end

    def user
      @user ||= Clients::User.new(username: @username, password: @password)
    end

    def web
      @web ||= Clients::Web.new(access_token: access_token)
    end

    def host
      @host ||= Clients::Host.new(access_token: access_token)
    end

    def resource_info
      @resource_info ||= Clients::ResourceInfo.new(access_token: access_token)
    end

    private

    def access_token
      @access_token ||= user.access_token
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zoomeye-rb-0.1.1 lib/zoomeye/api.rb