Class: Zikrash::SendReport

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_key, exception_info_data, session_info, params_info, additional_reports) ⇒ SendReport

Returns a new instance of SendReport.



14
15
16
17
18
19
20
# File 'lib/zikrash/send_report.rb', line 14

def initialize(project_key, exception_info_data, session_info, params_info, additional_reports)
  self.project_key = project_key
  self.exception_info_data = exception_info_data
  self.session_info = session_info
  self.params_info = params_info
  self.additional_reports = additional_reports
end

Instance Attribute Details

#additional_reportsObject

Returns the value of attribute additional_reports.



12
13
14
# File 'lib/zikrash/send_report.rb', line 12

def additional_reports
  @additional_reports
end

#exception_info_dataObject

Returns the value of attribute exception_info_data.



9
10
11
# File 'lib/zikrash/send_report.rb', line 9

def exception_info_data
  @exception_info_data
end

#params_infoObject

Returns the value of attribute params_info.



11
12
13
# File 'lib/zikrash/send_report.rb', line 11

def params_info
  @params_info
end

#project_keyObject

Returns the value of attribute project_key.



8
9
10
# File 'lib/zikrash/send_report.rb', line 8

def project_key
  @project_key
end

#session_infoObject

Returns the value of attribute session_info.



10
11
12
# File 'lib/zikrash/send_report.rb', line 10

def session_info
  @session_info
end

Instance Method Details

#let_it_goObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/zikrash/send_report.rb', line 22

def let_it_go
  project_url = unwrap_project_url

  begin
    uri = URI.parse(project_url)
    uri.kind_of?(URI::HTTP)
  rescue URI::InvalidURIError
    return false
  end

  http = Net::HTTP.new(uri.host, uri.port)

  request = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
  request.body = form_request_body

  http.request(request)
end