ruby_desk 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -109,7 +109,6 @@ module RubyDesk
109
109
  def prepare_and_invoke_api_call(path, options = {})
110
110
  api_call = prepare_api_call(path, options)
111
111
  data = invoke_api_call(api_call)
112
-
113
112
  parsed_data = case options[:format]
114
113
  when 'json' then JSON.parse(data)
115
114
  when 'xml' then REXML::Document.new(data)
@@ -62,6 +62,7 @@ class RubyDesk::TimeReport
62
62
 
63
63
  columns = [json['table']['cols']].flatten
64
64
  rows = [json['table']['rows']].flatten.map do |row_data|
65
+ next if row_data.empty?
65
66
  row = {}
66
67
  [row_data['c']].flatten.each_with_index do |row_element, element_index|
67
68
  column = columns[element_index]
@@ -69,7 +70,7 @@ class RubyDesk::TimeReport
69
70
  end
70
71
  row
71
72
  end
72
- return rows
73
+ return rows.compact
73
74
  end
74
75
 
75
76
  def self.build_query(options)
@@ -0,0 +1 @@
1
+ {"auth_user":{"messenger_id":"aseldawy", "timezone":"Africa/Cairo", "mail":"aseldawy@odesk.com", "uid":"aseldawy", "timezone_offset":"0", "first_name":"Ahmed El-Dawy", "last_name":".", "messenger_type":"yahoo"}, "table":{"rows":[""], "cols":[{"type":"number", "label":"hours"}, {"type":"date", "label":"worked_on"}]}, "server_time":"1266912462"}
@@ -131,6 +131,14 @@ class TestRubyDesk < Test::Unit::TestCase
131
131
  assert timereport.first['hours'].is_a?(Numeric)
132
132
  end
133
133
 
134
+ def test_empty_timreport
135
+ connector = dummy_connector('empty_timereport.json')
136
+
137
+ timereport = RubyDesk::TimeReport.find(connector,
138
+ :select=>"worked_on, sum(hours)")
139
+ assert_equal 0, timereport.size
140
+ end
141
+
134
142
  def test_timreport_error
135
143
  assert_raises RubyDesk::Error do
136
144
  connector = dummy_connector('timereport_error.json')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_desk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed ElDawy
@@ -44,6 +44,7 @@ files:
44
44
  - lib/ruby_desk/snapshot.rb
45
45
  - lib/ruby_desk/team_room.rb
46
46
  - lib/ruby_desk/time_report.rb
47
+ - test/empty_timereport.json
47
48
  - test/helper.rb
48
49
  - test/profile.json
49
50
  - test/providers.json