Sha256: b85921440fd481d209e7edda7210af6d7fe314af2089f1e8f4214c60918260b4

Contents?: true

Size: 622 Bytes

Versions: 24

Compression:

Stored size: 622 Bytes

Contents

class Ey::Core::Model < Cistern::Model
  def url
    if self.class.attributes[:url]
      read_attribute(:url)
    else
      "#{self.collection.url}/#{self.id}"
    end
  end

  def self.range_parser(v)
    case v
    when Range then
      v
    when String then
      first, last = v.split("-").map(&:to_i)
      last ||= first
      Range.new(first, last)
    else
      v
    end
  end

  def update!(attributes)
    merge_attributes(attributes)
    save!
  end

  def save
    save!
  rescue Ey::Core::Response::Error
    false
  end

  def destroy
    destroy!
  rescue Ey::Core::Response::Error
    false
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
ey-core-3.1.2 lib/ey-core/model.rb
ey-core-3.1.1 lib/ey-core/model.rb
ey-core-3.1.0 lib/ey-core/model.rb
ey-core-3.0.5 lib/ey-core/model.rb
ey-core-3.0.4 lib/ey-core/model.rb
ey-core-3.0.3 lib/ey-core/model.rb
ey-core-3.0.2 lib/ey-core/model.rb
ey-core-3.0.1 lib/ey-core/model.rb
ey-core-3.0.0 lib/ey-core/model.rb
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/model.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/model.rb