Class: Ryext::Models::Optimization

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

Constant Summary collapse

COLLECTION_KEY =
'taskStatuses'
YEXT_ATTRIBUTES =
{
  task_id: 'taskId',
  status: 'status',
  locations_completed: 'locationCompleted',
  locations_eligible: 'locationEligible',
  task_link: 'taskLink',
  task_location_ids: 'taskLocationIds'
}

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



19
20
21
# File 'lib/ryext/models/optimization.rb', line 19

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

.default_path(params) ⇒ Object



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

def self.default_path(params)
  customer_id = params['customerId']
  path(params) || "/customers/#{customer_id}/optimizations"
end

.path(params) ⇒ Object



13
14
15
16
17
# File 'lib/ryext/models/optimization.rb', line 13

def self.path(params)
  customer_id = params['customerId']
  optimization_id = params['optimizationId']
  "/customers/#{customer_id}/optimizations/#{optimization_id}" unless customer_id.nil? || optimization_id.nil?
end