Sha256: b4d568bd422ad009e85ff3d3e99445fbe3a810e0387e725a58fe7aa462d166a1

Contents?: true

Size: 1008 Bytes

Versions: 27

Compression:

Stored size: 1008 Bytes

Contents

require 'cgi'

class Fastly
  class DictionaryItem < Base
    attr_accessor :dictionary_id, :item_key, :item_value, :service_id

    alias_method :key, :item_key
    alias_method :value, :item_value

    # Return the Service object this belongs to
    def service
      @service ||= fetcher.get(Service, service_id)
    end

    # :nodoc:
    def as_hash
      super.delete_if { |var| %w(service_id dictionary_id).include?(var) }
    end

    def self.get_path(service, dictionary_id, item_key, _opts = {})
      "/service/#{service}/dictionary/#{dictionary_id}/item/#{CGI::escape(item_key)}"
    end

    def self.post_path(opts)
      "/service/#{opts[:service_id]}/dictionary/#{opts[:dictionary_id]}/item"
    end

    def self.put_path(obj)
      get_path(obj.service_id, obj.dictionary_id, obj.item_key)
    end

    def self.delete_path(obj)
      put_path(obj)
    end

    def self.list_path(opts = {})
      "/service/#{opts[:service_id]}/dictionary/#{opts[:dictionary_id]}/items"
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fastly-3.0.2 lib/fastly/dictionary_item.rb
fastly-3.0.1 lib/fastly/dictionary_item.rb
fastly-3.0.0 lib/fastly/dictionary_item.rb
fastly-2.5.3 lib/fastly/dictionary_item.rb
fastly-2.5.2 lib/fastly/dictionary_item.rb
fastly-2.5.1 lib/fastly/dictionary_item.rb
fastly-2.5.0 lib/fastly/dictionary_item.rb
fastly-2.4.0 lib/fastly/dictionary_item.rb
fastly-2.3.1 lib/fastly/dictionary_item.rb
fastly-2.3.0 lib/fastly/dictionary_item.rb
fastly-2.2.0 lib/fastly/dictionary_item.rb
fastly-2.1.0 lib/fastly/dictionary_item.rb
fastly-2.0.0 lib/fastly/dictionary_item.rb
fastly-1.15.0 lib/fastly/dictionary_item.rb
fastly-1.14.0 lib/fastly/dictionary_item.rb
fastly-1.13.2 lib/fastly/dictionary_item.rb
fastly-1.13.1 lib/fastly/dictionary_item.rb
fastly-1.13.0 lib/fastly/dictionary_item.rb
fastly-1.12.0 lib/fastly/dictionary_item.rb
fastly-1.11.0 lib/fastly/dictionary_item.rb