Class: Ryext::Models::Offer

Inherits:
Object
  • Object
show all
Extended by:
Finder
Includes:
Model
Defined in:
lib/ryext/models/offer.rb

Constant Summary collapse

COLLECTION_KEY =
'offers'
YEXT_ATTRIBUTES =
{
  id: 'id',
  name: 'name',
  publishers: 'publishers'
}

Class Method Summary collapse

Methods included from Finder

all, base_uri, base_url, collection_from, get, instance_klass

Methods included from Model

#build, included, #initialize, #instance_klass

Class Method Details

.clean_params(params) ⇒ Object



17
18
19
# File 'lib/ryext/models/offer.rb', line 17

def self.clean_params(params)
  params.reject { |k| ['id'].include? k }
end

.default_path(params) ⇒ Object



8
9
10
# File 'lib/ryext/models/offer.rb', line 8

def self.default_path(params)
  path(params) || '/offers'
end

.path(params) ⇒ Object



12
13
14
15
# File 'lib/ryext/models/offer.rb', line 12

def self.path(params)
  id = params['id']
  "/offers/#{id}" unless id.nil?
end