Class: Fog::DNS::Google::Changes

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/dns/google/models/changes.rb

Instance Method Summary collapse

Instance Method Details

#allArray<Fog::DNS::Google::Change>

Enumerates the list of Changes

Returns:


13
14
15
16
17
18
19
20
21
# File 'lib/fog/dns/google/models/changes.rb', line 13

def all
  requires :zone

  data = service.list_changes(zone.identity).to_h[:changes] || []
  load(data)
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  []
end

#get(identity) ⇒ Fog::DNS::Google::Change

Fetches the representation of an existing Change

Parameters:

  • identity (String)

    Change identity

Returns:


28
29
30
31
32
33
34
35
36
# File 'lib/fog/dns/google/models/changes.rb', line 28

def get(identity)
  requires :zone
  if change = service.get_change(zone.identity, identity).to_h
    new(change)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end

#new(attributes = {}) ⇒ Fog::DNS::Google::Change

Creates a new instance of a Change

Returns:


42
43
44
45
46
# File 'lib/fog/dns/google/models/changes.rb', line 42

def new(attributes = {})
  requires :zone

  super({ :zone => zone }.merge!(attributes))
end