Class: Outbrain::Api::PromotedLink
- Inherits:
-
Base
- Object
- Hash
- Base
- Outbrain::Api::PromotedLink
show all
- Defined in:
- lib/outbrain/api/promoted_link.rb
Constant Summary
collapse
- PATH =
"promotedLinks"
- RESOURCE_NAME =
PATH
Instance Attribute Summary
Attributes inherited from Base
#errors
Class Method Summary
collapse
Methods inherited from Base
#extract_query_options, #initialize, #persisted?, #valid?
Constructor Details
This class inherits a constructor from Outbrain::Base
Class Method Details
.campaign_path(campaign_id) ⇒ Object
9
10
11
|
# File 'lib/outbrain/api/promoted_link.rb', line 9
def self.campaign_path(campaign_id)
"campaigns/#{campaign_id}/#{PATH}"
end
|
.create(attributes) ⇒ Object
13
14
15
16
|
# File 'lib/outbrain/api/promoted_link.rb', line 13
def self.create(attributes)
Request.create(campaign_path(attributes.delete(:campaign_id)),
{ as: self, attributes: attributes })
end
|
.find(id) ⇒ Object
18
19
20
|
# File 'lib/outbrain/api/promoted_link.rb', line 18
def self.find(id)
Request.find( PATH, id, { as: self })
end
|
.update(id, attributes) ⇒ Object
27
28
29
|
# File 'lib/outbrain/api/promoted_link.rb', line 27
def self.update(id, attributes)
Request.update(PATH, id, {as: self, attributes: attributes, wrap_response: false })
end
|
.where(options) ⇒ Object
22
23
24
25
|
# File 'lib/outbrain/api/promoted_link.rb', line 22
def self.where(options)
Request.where(campaign_path(options.fetch(:campaign_id)),
options, as: self, resource_name: RESOURCE_NAME)
end
|