Class: Consumer
- Inherits:
-
Object
- Object
- Consumer
- Defined in:
- lib/cwr.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #create_webhook(post_uri, post_data = nil, post_headers = nil) ⇒ Object
- #destroy ⇒ Object
- #id ⇒ Object
-
#initialize(cwr, producer, name, consumer_path = nil) ⇒ Consumer
constructor
A new instance of Consumer.
Constructor Details
#initialize(cwr, producer, name, consumer_path = nil) ⇒ Consumer
Returns a new instance of Consumer.
46 47 48 49 50 51 |
# File 'lib/cwr.rb', line 46 def initialize(cwr, producer, name, consumer_path=nil) @cwr = cwr @producer = producer @name = name @path = consumer_path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
44 45 46 |
# File 'lib/cwr.rb', line 44 def path @path end |
Instance Method Details
#create_webhook(post_uri, post_data = nil, post_headers = nil) ⇒ Object
62 63 64 |
# File 'lib/cwr.rb', line 62 def create_webhook(post_uri, post_data=nil, post_headers=nil) @producer.create_webhook(self, post_uri, post_data, post_headers) end |
#destroy ⇒ Object
53 54 55 56 |
# File 'lib/cwr.rb', line 53 def destroy @cwr.destroy_consumer(self) return DestroyedConsumer.new(path) end |
#id ⇒ Object
58 59 60 |
# File 'lib/cwr.rb', line 58 def id @path ? @path.split("/")[-1] : nil end |