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
- #all(account, params = {}) ⇒ Object
- #base_uri ⇒ Object
- #base_url(params) ⇒ Object
- #collection_from(data) ⇒ Object
- #get(account, params = {}) ⇒ Object
- #instance_klass ⇒ Object
Instance Method Details
#all(account, params = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/ryext/models/finder.rb', line 16 def all(account, params = {}) query = Query.new(self, params) self.collection_from(account.request(query).data).map { |item| new(item, account) } end |
#base_uri ⇒ Object
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(account, params = {}) query = Query.new(self, params) new(account.request(query).data, account) end |
#instance_klass ⇒ Object
12 13 14 |
# File 'lib/ryext/models/finder.rb', line 12 def instance_klass OpenStruct end |