togman 0.2 → 0.3

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.
Files changed (4) hide show
  1. data/bin/togman +2 -2
  2. data/lib/mantis.rb +23 -15
  3. data/lib/toggl.rb +2 -0
  4. metadata +4 -4
data/bin/togman CHANGED
@@ -30,8 +30,8 @@ end
30
30
  config = YAML::load_file configfile
31
31
 
32
32
  Savon.configure do |setting|
33
- setting.log = false # disable logging
34
- # config.log_level = :info # changing the log level
33
+ setting.log = false # disable logging
34
+ #setting.log_level = :debug # changing the log level
35
35
  end
36
36
 
37
37
  t = Toggl.new config['toggl_api_key'], config['nonbill']
@@ -25,20 +25,28 @@ XML
25
25
  def add_note (issue_id, text, time_tracking)
26
26
  user = @user
27
27
  password = @password
28
- res = @client.request "mc_issue_note_add" do
29
- soap.body = <<XML
30
- <username>#{user}</username>
31
- <password>#{password}</password>
32
- <issue_id>#{issue_id}</issue_id>
33
- <note>
34
- <text>#{text}</text>
35
- <view_state>
36
- <name>private</name>
37
- <id>50</id>
38
- </view_state>
39
- <time_tracking>#{time_tracking}</time_tracking>
40
- </note>
41
- XML
42
- end
28
+ begin
29
+ res = @client.request "mc_issue_note_add" do
30
+ soap.body = {
31
+ "username" => user,
32
+ "password" => password,
33
+ "issue_id" => issue_id,
34
+ "note" => {
35
+ "text" => text,
36
+ "view_state" => {
37
+ "name" => "private",
38
+ "id" => 50,
39
+ :order! => ["name", "id"]
40
+ },
41
+ "time_tracking" => time_tracking,
42
+ :order! => ["text", "view_state", "time_tracking"]
43
+ },
44
+ :order! => ["username","password","issue_id","note"]
45
+ }
46
+ end
47
+ rescue Savon::Error
48
+ puts "ERROR!"
49
+ exit
50
+ end
43
51
  end
44
52
  end
@@ -17,7 +17,9 @@ class Toggl
17
17
 
18
18
  def entries (from, to)
19
19
  log = {}
20
+
20
21
  res = @sess.get('/api/v5/time_entries.json?start_date=' + from + '&end_date=' + to).body
22
+
21
23
  JSON.parse(res)["data"].each do |item|
22
24
  raw = item["description"]
23
25
 
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- version: "0.2"
8
+ - 3
9
+ version: "0.3"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Benjamin Johnson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-10-24 00:00:00 Z
17
+ date: 2011-11-02 00:00:00 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: patron