Class: Barge::Client

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

Constant Summary collapse

DEFAULT_OPTIONS =
{}
DIGITAL_OCEAN_URL =
'https://api.digitalocean.com/v2'
TIMEOUTS =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = DEFAULT_OPTIONS) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:

  • _self (Barge::Client)

    the object that the method was called on



20
21
22
23
24
25
# File 'lib/barge/client.rb', line 20

def initialize(options = DEFAULT_OPTIONS)
  self.access_token = options.fetch(:access_token, nil)
  yield(self) if block_given?
  fail ArgumentError, 'missing access_token' unless access_token
  initialize_resources
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



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

def access_token
  @access_token
end

#actionObject (readonly)

Returns the value of attribute action.



8
9
10
# File 'lib/barge/client.rb', line 8

def action
  @action
end

#domainObject (readonly)

Returns the value of attribute domain.



9
10
11
# File 'lib/barge/client.rb', line 9

def domain
  @domain
end

#dropletObject (readonly)

Returns the value of attribute droplet.



10
11
12
# File 'lib/barge/client.rb', line 10

def droplet
  @droplet
end

#imageObject (readonly)

Returns the value of attribute image.



11
12
13
# File 'lib/barge/client.rb', line 11

def image
  @image
end

#keyObject (readonly)

Returns the value of attribute key.



12
13
14
# File 'lib/barge/client.rb', line 12

def key
  @key
end

#regionObject (readonly)

Returns the value of attribute region.



13
14
15
# File 'lib/barge/client.rb', line 13

def region
  @region
end

#sizeObject (readonly)

Returns the value of attribute size.



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

def size
  @size
end