Class: Producer

Inherits:
Object
  • Object
show all
Defined in:
lib/cwr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cwr, name, path = nil, owner_id = nil) ⇒ Producer

Returns a new instance of Producer.



7
8
9
10
11
12
13
14
15
# File 'lib/cwr.rb', line 7

def initialize(cwr,
               name,
               path=nil,
               owner_id=nil)
  @cwr = cwr
  @name = name
  @path = path
  @owner_id = owner_id
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/cwr.rb', line 5

def path
  @path
end

Instance Method Details

#create_consumer(name) ⇒ Object



22
23
24
# File 'lib/cwr.rb', line 22

def create_consumer(name)
  @cwr.create_consumer self, name
end

#create_mass_webhooksObject



30
31
32
# File 'lib/cwr.rb', line 30

def create_mass_webhooks
  raise "Not implemented"
end

#create_webhook(consumer, webhook_post_uri, post_data = nil, post_headers = nil) ⇒ Object



26
27
28
# File 'lib/cwr.rb', line 26

def create_webhook(consumer, webhook_post_uri, post_data=nil, post_headers=nil)
  @cwr.create_webhook(consumer, webhook_post_uri, post_data, post_headers)
end

#destroyObject



17
18
19
20
# File 'lib/cwr.rb', line 17

def destroy
  @cwr.destroy_producer(self)
  return DestroyedProducer.new(path)
end

#idObject



34
35
36
# File 'lib/cwr.rb', line 34

def id
  @path ? @path.split("/")[-1] : nil
end

#list_consumersObject



38
39
40
# File 'lib/cwr.rb', line 38

def list_consumers
  @cwr.list_consumers(self)
end