Class: Fog::CDN::AWS::Invalidation

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/cdn/invalidation.rb

Instance Method Summary collapse

Constructor Details

#initialize(new_attributes = {}) ⇒ Invalidation

Returns a new instance of Invalidation.



12
13
14
15
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 12

def initialize(new_attributes={})
  new_attributes[:caller_reference] ||= Time.now.utc.to_i.to_s
  super(invalidation_to_attributes(new_attributes))
end

Instance Method Details

#destroyObject



34
35
36
37
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 34

def destroy
  # invalidations can't be removed, but tests are requiring they do :)
  true
end

#distributionObject



17
18
19
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 17

def distribution
  @distribution
end

#ready?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 21

def ready?
  requires :id, :status
  status == 'Completed'
end

#saveObject



26
27
28
29
30
31
32
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 26

def save
  requires :paths, :caller_reference
  raise "Submitted invalidation cannot be submitted again" if persisted?
  response = service.post_invalidation(distribution.identity, paths, caller_reference)
  merge_attributes(invalidation_to_attributes(response.body))
  true
end