debugged-ruby 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module Debugged
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
data/lib/debugged-ruby.rb CHANGED
@@ -10,7 +10,6 @@ module Debugged
10
10
  @@api_key = nil
11
11
 
12
12
  def self.api_key=(api_key)
13
- puts 'SOUNDS LEGIT TO ME'
14
13
  @@api_key = api_key
15
14
  end
16
15
 
@@ -18,20 +17,14 @@ module Debugged
18
17
  @@api_key
19
18
  end
20
19
 
21
- def self.report(name, data, e)
20
+ def self.report(e, data=nil)
22
21
 
23
- unless data.is_a? Hash
22
+ unless data.is_a? Hash or data.nil?
24
23
  #Log this
25
24
  raise ArgumentError, 'Data argument is not Hash'
26
25
  end
27
26
 
28
- unless name.is_a? String
29
- #Log this
30
- raise ArgumentError, 'Name argument is not String'
31
- end
32
-
33
- name ||= ""
34
- data ||= ""
27
+ data ||= {}
35
28
 
36
29
  time = Time.now.utc.to_i
37
30
  hash = Digest::SHA1.base64digest @@api_key.to_s+name+"ruby"+time.to_s
@@ -40,14 +33,14 @@ module Debugged
40
33
  {
41
34
  "created_at" => time,
42
35
  "identifier" => hash,
43
- "exception_name" => name,
36
+ "exception_name" => e.class.to_s,
44
37
  "sdk_version" => "ruby",
45
38
  "stack_trace" => e.backtrace.join("\n"),
46
39
  "message" => e.message,
47
40
  "line_number" => e.backtrace[0].split(":").last.to_i,
48
41
  "character_number" => -1,
49
42
  "filename" => e.backtrace[0].split("/").last.split(":").first,
50
- "user_custom_data" => data,
43
+ "user_custom_data" => data.to_json,
51
44
  "sdk_data" => {"ruby_version" => RUBY_VERSION.to_s,
52
45
  "platform" => RUBY_PLATFORM.to_s}
53
46
  }
@@ -67,6 +60,8 @@ module Debugged
67
60
  #do something
68
61
  end
69
62
 
63
+ puts report.to_json
64
+ puts res.inspect
70
65
  "debugged.herokuapp.com/report/"+hash.to_s
71
66
  end
72
67
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugged-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: