Class: Apruve::WebhookEndpoint
- Inherits:
-
ApruveObject
- Object
- ApruveObject
- Apruve::WebhookEndpoint
- Defined in:
- lib/apruve/resources/webhook_endpoint.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApruveObject
#initialize, logger, #logger, #to_hash, #to_json, #validate
Constructor Details
This class inherits a constructor from Apruve::ApruveObject
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 3 def id @id end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
3 4 5 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 3 def merchant_id @merchant_id end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 3 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 3 def version @version end |
Class Method Details
.find(merchant_id, id) ⇒ Object
5 6 7 8 9 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 5 def self.find(merchant_id, id) response = Apruve.get("merchants/#{merchant_id}/webhook_endpoints/#{id}") logger.debug response.body WebhookEndpoint.new(response.body.merge(merchant_id: merchant_id)) end |
.where(merchant_id) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 11 def self.where(merchant_id) response = Apruve.get("merchants/#{merchant_id}/webhook_endpoints") logger.debug response.body ret = [] response.body.each do |i| ret << WebhookEndpoint.new(i.merge(merchant_id: merchant_id)) end ret end |
Instance Method Details
#create! ⇒ Object
27 28 29 30 31 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 27 def create! response = Apruve.post("merchants/#{merchant_id}/webhook_endpoints", {webhook_endpoint: self}.to_json ) logger.debug response.body initialize response.body end |
#destroy! ⇒ Object
21 22 23 24 25 |
# File 'lib/apruve/resources/webhook_endpoint.rb', line 21 def destroy! response = Apruve.delete("merchants/#{merchant_id}/webhook_endpoints/#{id}") logger.debug response.body response.status end |