Class: Consumer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#destroyObject



53
54
55
56
# File 'lib/cwr.rb', line 53

def destroy
  @cwr.destroy_consumer(self)
  return DestroyedConsumer.new(path)
end

#idObject



58
59
60
# File 'lib/cwr.rb', line 58

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