Exception: CloudflareAPIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/logstash/inputs/cloudflare.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, response, content) ⇒ CloudflareAPIError

Returns a new instance of CloudflareAPIError.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/logstash/inputs/cloudflare.rb', line 15

def initialize(url, response, content)
  begin
    json_data = JSON.parse(content)
  rescue JSON::ParserError
    json_data = {}
  end
  @url = url
  @success = json_data.fetch('success', false)
  @errors = json_data.fetch('errors', [])
  @status_code = response.code
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



11
12
13
# File 'lib/logstash/inputs/cloudflare.rb', line 11

def errors
  @errors
end

#status_codeObject

Returns the value of attribute status_code.



13
14
15
# File 'lib/logstash/inputs/cloudflare.rb', line 13

def status_code
  @status_code
end

#successObject

Returns the value of attribute success.



12
13
14
# File 'lib/logstash/inputs/cloudflare.rb', line 12

def success
  @success
end

#urlObject

Returns the value of attribute url.



10
11
12
# File 'lib/logstash/inputs/cloudflare.rb', line 10

def url
  @url
end