Class: ProcessOut::Webhook

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Webhook

Initializes the Webhook object Params:

client

ProcessOut client instance



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/processout/webhook.rb', line 90

def initialize(client)
  @client = client

  @id = ""
  @project = nil
  @event = nil
  @request_url = ""
  @request_method = ""
  @response_body = ""
  @response_code = ""
  @response_headers = ""
  @response_time_ms = 0
  @status = 0
  @created_at = ""
  @release_at = ""
  
end

Instance Attribute Details

#created_at ⇒ Object

Returns the value of attribute created_at.



20
21
22
# File 'lib/processout/webhook.rb', line 20

def created_at
  @created_at
end

#event ⇒ Object

Returns the value of attribute event.



12
13
14
# File 'lib/processout/webhook.rb', line 12

def event
  @event
end

#id ⇒ Object

Returns the value of attribute id.



10
11
12
# File 'lib/processout/webhook.rb', line 10

def id
  @id
end

#project ⇒ Object

Returns the value of attribute project.



11
12
13
# File 'lib/processout/webhook.rb', line 11

def project
  @project
end

#release_at ⇒ Object

Returns the value of attribute release_at.



21
22
23
# File 'lib/processout/webhook.rb', line 21

def release_at
  @release_at
end

#request_method ⇒ Object

Returns the value of attribute request_method.



14
15
16
# File 'lib/processout/webhook.rb', line 14

def request_method
  @request_method
end

#request_url ⇒ Object

Returns the value of attribute request_url.



13
14
15
# File 'lib/processout/webhook.rb', line 13

def request_url
  @request_url
end

#response_body ⇒ Object

Returns the value of attribute response_body.



15
16
17
# File 'lib/processout/webhook.rb', line 15

def response_body
  @response_body
end

#response_code ⇒ Object

Returns the value of attribute response_code.



16
17
18
# File 'lib/processout/webhook.rb', line 16

def response_code
  @response_code
end

#response_headers ⇒ Object

Returns the value of attribute response_headers.



17
18
19
# File 'lib/processout/webhook.rb', line 17

def response_headers
  @response_headers
end

#response_time_ms ⇒ Object

Returns the value of attribute response_time_ms.



18
19
20
# File 'lib/processout/webhook.rb', line 18

def response_time_ms
  @response_time_ms
end

#status ⇒ Object

Returns the value of attribute status.



19
20
21
# File 'lib/processout/webhook.rb', line 19

def status
  @status
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



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/processout/webhook.rb', line 111

def fill_with_data(data)
  if data.include? "id"
    @id = data["id"]
  end
  if data.include? "project"
    @project = data["project"]
  end
  if data.include? "event"
    @event = data["event"]
  end
  if data.include? "request_url"
    @request_url = data["request_url"]
  end
  if data.include? "request_method"
    @request_method = data["request_method"]
  end
  if data.include? "response_body"
    @response_body = data["response_body"]
  end
  if data.include? "response_code"
    @response_code = data["response_code"]
  end
  if data.include? "response_headers"
    @response_headers = data["response_headers"]
  end
  if data.include? "response_time_ms"
    @response_time_ms = data["response_time_ms"]
  end
  if data.include? "status"
    @status = data["status"]
  end
  if data.include? "created_at"
    @created_at = data["created_at"]
  end
  if data.include? "release_at"
    @release_at = data["release_at"]
  end
  
  self
end