Sha256: ebc25330fc0b45f327f19a078c013d29cc0b4fd938713bf81395f4c3e9cc7ab0

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

require 'fog/core/model'

module Fog
  module Terremark
    module Shared

      class Task < Fog::Model

        identity :id

        attribute :end_time,    :aliases => 'endTime'
        attribute :owner,       :aliases => 'Owner'
        attribute :result,      :aliases => 'Result'
        attribute :start_time,  :aliases => 'startTime'
        attribute :status
        attribute :link,        :aliases => 'Link'
        attribute :error,       :aliases => 'Error'

        def initialize(attributes = {})
          new_owner  = attributes.delete('Owner')
          new_result = attributes.delete('Result')
          new_error = attributes.delete('Error')
          new_cancel_link = attributes.delete('Link')

          super
          @owner  = connection.parse(new_owner)
          if new_result
            @result = connection.parse(new_result)
          end
          @error = connection.parse(new_error) if new_error
          @cancel_link = connection.parse(new_cancel_link) if new_cancel_link
        end

        def ready?
          @status == 'success'
        end

        private

        def href=(new_href)
          @id = new_href.split('/').last.to_i
        end

        def type=(new_type); end

      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fog-0.3.22 lib/fog/terremark/models/shared/task.rb
fog-0.3.21 lib/fog/terremark/models/shared/task.rb
fog-0.3.20 lib/fog/terremark/models/shared/task.rb
fog-0.3.19 lib/fog/terremark/models/shared/task.rb
fog-0.3.18 lib/fog/terremark/models/shared/task.rb
fog-0.3.17 lib/fog/terremark/models/shared/task.rb
fog-0.3.16 lib/fog/terremark/models/shared/task.rb
fog-0.3.15 lib/fog/terremark/models/shared/task.rb
fog-0.3.14 lib/fog/terremark/models/shared/task.rb
fog-0.3.13 lib/fog/terremark/models/shared/task.rb
fog-0.3.12 lib/fog/terremark/models/shared/task.rb
fog-0.3.11 lib/fog/terremark/models/shared/task.rb
fog-0.3.10 lib/fog/terremark/models/shared/task.rb
fog-0.3.9 lib/fog/terremark/models/shared/task.rb
fog-0.3.8 lib/fog/terremark/models/shared/task.rb