Class: Cased::Clients

Inherits:
Object
  • Object
show all
Defined in:
lib/cased/clients.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(api_key:, url: nil, raise_on_errors: false) ⇒ Object



7
8
9
10
11
# File 'lib/cased/clients.rb', line 7

def self.create(api_key:, url: nil, raise_on_errors: false)
  url ||= Cased.config.api_url

  Cased::HTTP::Client.new(url: url, api_key: api_key, raise_on_errors: raise_on_errors)
end

Instance Method Details

#cliObject



21
22
23
# File 'lib/cased/clients.rb', line 21

def cli
  @cli ||= self.class.create(api_key: Cased.config.guard_application_key)
end

#organizationObject



13
14
15
# File 'lib/cased/clients.rb', line 13

def organization
  @organization ||= self.class.create(api_key: ENV.fetch('CASED_ORGANIZATION_KEY'))
end

#publishObject



17
18
19
# File 'lib/cased/clients.rb', line 17

def publish
  @publish ||= self.class.create(url: Cased.config.publish_url, api_key: Cased.config.publish_key, raise_on_errors: true)
end