Class: Producer
- Inherits:
-
Object
- Object
- Producer
- Defined in:
- lib/cwr.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #create_consumer(name) ⇒ Object
- #create_mass_webhooks ⇒ Object
- #create_webhook(consumer, webhook_post_uri, post_data = nil, post_headers = nil) ⇒ Object
- #destroy ⇒ Object
- #id ⇒ Object
-
#initialize(cwr, name, path = nil, owner_id = nil) ⇒ Producer
constructor
A new instance of Producer.
- #list_consumers ⇒ Object
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
#path ⇒ Object (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_webhooks ⇒ Object
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 |
#destroy ⇒ Object
17 18 19 20 |
# File 'lib/cwr.rb', line 17 def destroy @cwr.destroy_producer(self) return DestroyedProducer.new(path) end |
#id ⇒ Object
34 35 36 |
# File 'lib/cwr.rb', line 34 def id @path ? @path.split("/")[-1] : nil end |
#list_consumers ⇒ Object
38 39 40 |
# File 'lib/cwr.rb', line 38 def list_consumers @cwr.list_consumers(self) end |