Sha256: 1347328289c5bed10dba83be13d32a5f3978ff8e65dc853d16324abfbf3ea254

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

require 'fog/core/model'

module Fog
  module Tasks
    class Wunderlist 
      class List < Fog::Model
        
        identity  :id

        attribute :title
        attribute :created_at,       :type => :time
        attribute :updated_at,       :type => :time
        attribute :version
        attribute :local_identifier
        attribute :position
        attribute :type
        attribute :owner_id
        
        def destroy
          requires :id
          service.delete_list(id)
          true
        end

        def save
          requires :title
          if identity
            update
          else
            merge_attributes(
              service.create_list(title, attributes).body
            )
          end
          true
        end

        def update
          requires :id
          merge_attributes(
            service.update_list(id, attributes).body
          )
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-wunderlist-0.1 lib/fog/wunderlist/models/tasks/list.rb