Class: ZoomEye::API

Inherits:
Object
  • Object
show all
Defined in:
lib/zoomeye/api.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key: ENV["ZOOMEYE_API_KEY"]) ⇒ API

Returns a new instance of API.

Raises:

  • (ArgumentError)

5
6
7
8
# File 'lib/zoomeye/api.rb', line 5

def initialize(api_key: ENV["ZOOMEYE_API_KEY"])
  @api_key = api_key
  raise ArgumentError, "No API key has been found or provided!" unless @api_key
end

Instance Method Details

#hostObject


14
15
16
# File 'lib/zoomeye/api.rb', line 14

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

#resource_infoObject


18
19
20
# File 'lib/zoomeye/api.rb', line 18

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

#webObject


10
11
12
# File 'lib/zoomeye/api.rb', line 10

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