Module: Ryext::Models::Finder

Included in:
Category, Customer, Location, Offer, Optimization, OptimizationTask, Order, PublisherSuggestion, Status, Subscription
Defined in:
lib/ryext/models/finder.rb

Instance Method Summary collapse

Instance Method Details

#all(account, params = {}) ⇒ Object



16
17
18
19
20
# File 'lib/ryext/models/finder.rb', line 16

def all(, params = {})
  query = Query.new(self, params)

  self.collection_from(.request(query).data).map { |item| new(item, ) }
end

#base_uriObject



4
5
6
# File 'lib/ryext/models/finder.rb', line 4

def base_uri
  'https://api.yext.com/v1'
end

#base_url(params) ⇒ Object



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

def base_url(params)
  base_uri + default_path(params)
end

#collection_from(data) ⇒ Object



28
29
30
# File 'lib/ryext/models/finder.rb', line 28

def collection_from(data)
  data[self::COLLECTION_KEY]
end

#get(account, params = {}) ⇒ Object



22
23
24
25
26
# File 'lib/ryext/models/finder.rb', line 22

def get(, params = {})
  query = Query.new(self, params)

  new(.request(query).data, )
end

#instance_klassObject



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

def instance_klass
  OpenStruct
end