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.



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

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



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

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

#distributionObject



19
20
21
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 19

def distribution
  @distribution
end

#ready?Boolean

Returns:

  • (Boolean)


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

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

#saveObject



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

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