Class: Fastly::DictionaryItem

Inherits:
Base
  • Object
show all
Defined in:
lib/fastly/dictionary_item.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#fetcher

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#delete!, #initialize, path, #require_api_key!, #save!

Constructor Details

This class inherits a constructor from Fastly::Base

Instance Attribute Details

#dictionary_idObject

Returns the value of attribute dictionary_id.



5
6
7
# File 'lib/fastly/dictionary_item.rb', line 5

def dictionary_id
  @dictionary_id
end

#item_keyObject Also known as: key

Returns the value of attribute item_key.



5
6
7
# File 'lib/fastly/dictionary_item.rb', line 5

def item_key
  @item_key
end

#item_valueObject Also known as: value

Returns the value of attribute item_value.



5
6
7
# File 'lib/fastly/dictionary_item.rb', line 5

def item_value
  @item_value
end

#service_idObject

Returns the value of attribute service_id.



5
6
7
# File 'lib/fastly/dictionary_item.rb', line 5

def service_id
  @service_id
end

Class Method Details

.delete_path(obj) ⇒ Object



32
33
34
# File 'lib/fastly/dictionary_item.rb', line 32

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

.get_path(service, dictionary_id, item_key, _opts = {}) ⇒ Object



20
21
22
# File 'lib/fastly/dictionary_item.rb', line 20

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

.list_path(opts = {}) ⇒ Object



36
37
38
# File 'lib/fastly/dictionary_item.rb', line 36

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

.post_path(opts) ⇒ Object



24
25
26
# File 'lib/fastly/dictionary_item.rb', line 24

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

.put_path(obj) ⇒ Object



28
29
30
# File 'lib/fastly/dictionary_item.rb', line 28

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

Instance Method Details

#as_hashObject

:nodoc:



16
17
18
# File 'lib/fastly/dictionary_item.rb', line 16

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

#serviceObject

Return the Service object this belongs to



11
12
13
# File 'lib/fastly/dictionary_item.rb', line 11

def service
  @service ||= fetcher.get(Service, service_id)
end