Class: ProcessOut::WebhookEndpoint
- Inherits:
-
Object
- Object
- ProcessOut::WebhookEndpoint
- Defined in:
- lib/processout/webhook_endpoint.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#events_whitelist ⇒ Object
Returns the value of attribute events_whitelist.
-
#id ⇒ Object
Returns the value of attribute id.
-
#project ⇒ Object
Returns the value of attribute project.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ WebhookEndpoint
constructor
- Initializes the WebhookEndpoint object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the WebhookEndpoint object Params:
-
#new(data = {}) ⇒ Object
Create a new WebhookEndpoint using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
Constructor Details
#initialize(client, data = {}) ⇒ WebhookEndpoint
Initializes the WebhookEndpoint object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/processout/webhook_endpoint.rb', line 65 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.project = data.fetch(:project, nil) self.project_id = data.fetch(:project_id, nil) self.url = data.fetch(:url, nil) self.events_whitelist = data.fetch(:events_whitelist, nil) self.sandbox = data.fetch(:sandbox, nil) self.created_at = data.fetch(:created_at, nil) end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
16 17 18 |
# File 'lib/processout/webhook_endpoint.rb', line 16 def created_at @created_at end |
#events_whitelist ⇒ Object
Returns the value of attribute events_whitelist.
14 15 16 |
# File 'lib/processout/webhook_endpoint.rb', line 14 def events_whitelist @events_whitelist end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/processout/webhook_endpoint.rb', line 10 def id @id end |
#project ⇒ Object
Returns the value of attribute project.
11 12 13 |
# File 'lib/processout/webhook_endpoint.rb', line 11 def project @project end |
#project_id ⇒ Object
Returns the value of attribute project_id.
12 13 14 |
# File 'lib/processout/webhook_endpoint.rb', line 12 def project_id @project_id end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
15 16 17 |
# File 'lib/processout/webhook_endpoint.rb', line 15 def sandbox @sandbox end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/processout/webhook_endpoint.rb', line 13 def url @url end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/processout/webhook_endpoint.rb', line 86 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end if data.include? "project" self.project = data["project"] end if data.include? "project_id" self.project_id = data["project_id"] end if data.include? "url" self.url = data["url"] end if data.include? "events_whitelist" self.events_whitelist = data["events_whitelist"] end if data.include? "sandbox" self.sandbox = data["sandbox"] end if data.include? "created_at" self.created_at = data["created_at"] end self end |
#new(data = {}) ⇒ Object
Create a new WebhookEndpoint using the current client
79 80 81 |
# File 'lib/processout/webhook_endpoint.rb', line 79 def new(data = {}) WebhookEndpoint.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/processout/webhook_endpoint.rb', line 118 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.project = data.fetch(:project, self.project) self.project_id = data.fetch(:project_id, self.project_id) self.url = data.fetch(:url, self.url) self.events_whitelist = data.fetch(:events_whitelist, self.events_whitelist) self.sandbox = data.fetch(:sandbox, self.sandbox) self.created_at = data.fetch(:created_at, self.created_at) self end |