Class: Neuron::Client::AdZone

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/neuron-client/model/ad_zone.rb

Constant Summary collapse

ATTRIBUTES =
[
  :ad_id, # integer
  :zone_id, # string, UUID
  :weight, # number
  :priority, # integer, 1..10

  :created_at, #string, datetime in UTC
  :updated_at, #string, datetime in UTC
]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#apply_attributes!, #id=, included, #initialize, #save, #to_create_hash, #to_hash, #to_update_hash, #update_attributes, #valid?

Methods included from Base::ClassAndInstanceMethods

#all, #api=, #create, #create!, #find, #validate=

Class Method Details



37
38
39
40
41
42
# File 'lib/neuron-client/model/ad_zone.rb', line 37

def self.unlink(ad_id, zone_id)
  connected_to_admin!
  validate_id!(ad_id)
  validate_uuid!(zone_id)
  connection.delete("zones/#{zone_id}/ads/#{ad_id}")
end

Instance Method Details

#attributesObject



18
19
20
# File 'lib/neuron-client/model/ad_zone.rb', line 18

def attributes
  ATTRIBUTES
end

#destroyObject



30
31
32
33
34
35
# File 'lib/neuron-client/model/ad_zone.rb', line 30

def destroy
  connected_to_admin!
  validate_id!(ad_id)
  validate_uuid!(zone_id)
  connection.delete("zones/#{zone_id}/ads/#{ad_id}")
end

#idObject



26
27
28
# File 'lib/neuron-client/model/ad_zone.rb', line 26

def id
  nil
end

#new_record?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/neuron-client/model/ad_zone.rb', line 22

def new_record?
  true
end