Class: BundleUp::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bundleup/client.rb

Overview

Client for core BundleUp API resources.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/bundleup/client.rb', line 8

def initialize(api_key)
  raise ArgumentError, 'API key is required to initialize BundleUp SDK.' if api_key.nil? || api_key.empty?

  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/bundleup/client.rb', line 6

def api_key
  @api_key
end

Instance Method Details

#connectionsObject



14
15
16
# File 'lib/bundleup/client.rb', line 14

def connections
  @connections ||= BundleUp::Resources::Connection.new(@api_key)
end

#integrationsObject



18
19
20
# File 'lib/bundleup/client.rb', line 18

def integrations
  @integrations ||= BundleUp::Resources::Integration.new(@api_key)
end

#proxy(connection_id) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/bundleup/client.rb', line 26

def proxy(connection_id)
  if connection_id.nil? || connection_id.empty?
    raise ArgumentError, 'Connection ID is required to create a Proxy instance.'
  end

  BundleUp::Proxy.new(@api_key, connection_id)
end

#unify(connection_id) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/bundleup/client.rb', line 34

def unify(connection_id)
  if connection_id.nil? || connection_id.empty?
    raise ArgumentError, 'Connection ID is required to create a Unify instance.'
  end

  BundleUp::Unify::Client.new(@api_key, connection_id)
end

#webhooksObject



22
23
24
# File 'lib/bundleup/client.rb', line 22

def webhooks
  @webhooks ||= BundleUp::Resources::Webhook.new(@api_key)
end