Class: Moniker::Common

Inherits:
Base show all
Defined in:
lib/moniker/common.rb

Direct Known Subclasses

Domain, Record, Server

Class Method Summary collapse

Methods inherited from Base

headers, site, site=

Methods inherited from ActiveResource::Base

#load

Class Method Details

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object

Overrides ActiveResource::Base::collection_path to remove .<extension> from resources path



29
30
31
32
33
34
# File 'lib/moniker/common.rb', line 29

def self.collection_path(prefix_options = {}, query_options = nil)
  check_prefix_options(prefix_options)

  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end

.custom_method_collection_url(method_name, options = {}) ⇒ Object

Overrides ActiveResource::CustomMethods to remove .<extension>



37
38
39
40
# File 'lib/moniker/common.rb', line 37

def self.custom_method_collection_url(method_name, options = {})
  prefix_options, query_options = split_options(options)
  "#{prefix(prefix_options)}#{collection_name}/#{method_name}#{query_string(query_options)}"
end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object

Overrides ActiveResource::Base::element_path to remove .<extension> from resources path



21
22
23
24
25
26
# File 'lib/moniker/common.rb', line 21

def self.element_path(id, prefix_options = {}, query_options = nil)
  check_prefix_options(prefix_options)

  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}/#{URI.parser.escape id.to_s}#{query_string(query_options)}"
end