Sha256: 4af54805dfbd32414ddba664bca5a0e2402883d3bc1e8bf37d8dd98808d46f58

Contents?: true

Size: 1.08 KB

Versions: 21

Compression:

Stored size: 1.08 KB

Contents

require 'fog/core/model'

module Fog
  module SakuraCloud
    class Script
      class Note < Fog::Model
        identity :id, :aliases => 'ID'
        attribute :name, :aliases => 'Name'
        attribute :note_class, :aliases => 'Class'
        attribute :scope, :aliases => 'Scope'
        attribute :content, :aliases => 'Content'
        attribute :description, :aliases => 'Description'
        attribute :remark, :aliases => 'Remark'
        attribute :availability, :aliases => 'Availability'
        attribute :icon, :aliases => 'Icon'


        def delete
          service.delete_note(identity)
          true
        end
        alias_method :destroy, :delete

        def save
          requires :name, :content
          if identity
            Fog::Logger.warning("Update Note #{identity}")
            data = service.modify_note(@attributes).body["Note"]
          else
            Fog::Logger.warning("Create New Note")
            data = service.create_note(@attributes).body["Note"]
          end
          merge_attributes(data)
          true
        end
      end
    end
  end
end

Version data entries

21 entries across 19 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/note.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/note.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-sakuracloud-1.7.5/lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.5 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.4 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.3 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.2 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.1 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.7.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.6.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.5.2 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.5.1 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.5.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.4.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.3.3 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.3.2 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.3.1 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.3.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.2.0 lib/fog/sakuracloud/models/script/note.rb
fog-sakuracloud-1.1.1 lib/fog/sakuracloud/models/script/note.rb