liquidplanner 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,7 @@ require "liquidplanner/resources/package"
33
33
  require "liquidplanner/resources/folder"
34
34
  require "liquidplanner/resources/project"
35
35
  require "liquidplanner/resources/client"
36
+ require "liquidplanner/resources/timesheet_entry"
36
37
 
37
38
  require "liquidplanner/resources/luggage"
38
39
  require "liquidplanner/resources/note"
@@ -18,11 +18,11 @@ module LiquidPlanner
18
18
  end
19
19
 
20
20
  def account
21
- LiquidPlanner::Resources::Account.find(:one, :from => "/api/account")
21
+ LiquidPlanner::Resources::Account.find( :one, :from => "/api/account" )
22
22
  end
23
23
 
24
24
  def workspaces( scope=:all )
25
- LiquidPlanner::Resources::Workspace.find(scope)
25
+ LiquidPlanner::Resources::Workspace.find( scope )
26
26
  end
27
27
 
28
28
  private
@@ -7,7 +7,7 @@ module LiquidPlanner
7
7
 
8
8
  # LiquidPlanner does not send back data that is already in the path (prefix_options), so merge
9
9
  # any values that the object already had back into the prefix_options.
10
- def load(attributes)
10
+ def load(attributes, remove_root = false)
11
11
  initial_prefix_options = @prefix_options.clone
12
12
  super
13
13
  @prefix_options.merge!(initial_prefix_options){|k, old_attr,new_attr| old_attr || new_attr }
@@ -1,6 +1,16 @@
1
1
  module LiquidPlanner
2
2
  module Resources
3
3
  class Activity < Luggage
4
+
5
+ self.prefix = "/api/workspaces/:workspace_id/"
6
+
7
+ def collection_path(options = nil)
8
+ ret = super
9
+ puts ret.inspect
10
+ return ret unless options && options.item_id
11
+ "#{super}/#{options.item_id}"
12
+ end
13
+
4
14
  end
5
15
  end
6
16
  end
@@ -0,0 +1,6 @@
1
+ module LiquidPlanner
2
+ module Resources
3
+ class TimesheetEntry < WorkspaceResource
4
+ end
5
+ end
6
+ end
@@ -42,6 +42,18 @@ module LiquidPlanner
42
42
  CustomField.find( scope, :params => { :workspace_id => self.id }.merge(options) )
43
43
  end
44
44
 
45
+ def activities( scope=:all, options={} )
46
+ Activity.find( scope, :params => {
47
+ :workspace_id => self.id
48
+ }.merge(options) )
49
+ end
50
+
51
+ def timesheet_entries scope = :all, options = {}
52
+ TimesheetEntry.find( scope, :params => {
53
+ :workspace_id => self.id
54
+ }.merge( options ) );
55
+ end
56
+
45
57
  protected
46
58
 
47
59
  # create a new instance of klass (Task, Folder, etc.),
@@ -1,5 +1,5 @@
1
1
  require 'test/unit'
2
- require 'mocha'
2
+ require 'mocha/setup'
3
3
  require File.dirname(__FILE__) + '/../lib/liquidplanner'
4
4
 
5
5
  # Test that the special behaviors that LiquidPlanner expects behave sanely.
@@ -7,15 +7,15 @@ class LiquidPlannerResourceTest < Test::Unit::TestCase
7
7
  def setup
8
8
  @email = 'testing@example.com'
9
9
  @password = 'password'
10
- @lp = LiquidPlanner::Base.new(:email=>@email, :password=>@password)
10
+ @lp = LiquidPlanner::Base.new( :email => @email, :password => @password )
11
11
  end
12
12
 
13
13
  # LiquidPlanner does not include redundant data in the responses, ensure that workspace_id is preserved
14
14
  def test_loading_does_not_clobber_prefix_options
15
15
  id = 7
16
16
  task = LiquidPlanner::Resources::Task.new()
17
- task.prefix_options = {:workspace_id=>id}
18
- task.load(:name=>'cake')
17
+ task.prefix_options = { :workspace_id => id }
18
+ task.load( :name => 'cake' )
19
19
 
20
20
  assert_equal id, task.workspace_id
21
21
  end
@@ -26,12 +26,12 @@ class LiquidPlannerResourceTest < Test::Unit::TestCase
26
26
  workspace_id = 9
27
27
  comment_text = "hello"
28
28
 
29
- task = LiquidPlanner::Resources::Task.new(:workspace_id=>workspace_id, :id=>task_id, :name=>'new task')
30
- comment = task.build_comment(:comment=>comment_text)
29
+ task = LiquidPlanner::Resources::Task.new( :workspace_id => workspace_id, :id => task_id, :name => 'new task' )
30
+ comment = task.build_comment( :comment => { :comment => comment_text } )
31
31
  assert_equal LiquidPlanner::Resources::Comment, comment.class
32
32
 
33
33
  assert_equal task_id, comment.prefix_options[:item_id]
34
34
  assert_equal workspace_id, comment.prefix_options[:workspace_id]
35
35
  assert_equal comment_text, comment.comment
36
36
  end
37
- end
37
+ end
@@ -1,5 +1,4 @@
1
1
  require 'test/unit'
2
- require 'mocha'
3
2
  require File.dirname(__FILE__) + '/../lib/liquidplanner'
4
3
 
5
4
  # Very Basic tests around the workspace resource to ensure that it generates proper calls to ActiveResource.
@@ -8,24 +7,33 @@ class WorkspaceTest < Test::Unit::TestCase
8
7
  @email = 'testing@example.com'
9
8
  @password = 'password'
10
9
  @lp = LiquidPlanner::Base.new(:email=>@email, :password=>@password)
10
+
11
+ ActiveResource::HttpMock.respond_to do |mock|
12
+ headers = {
13
+ "Authorization" => "Basic dGVzdGluZ0BleGFtcGxlLmNvbTpwYXNzd29yZA==",
14
+ "accept-encoding" => "gzip",
15
+ "Accept" => "application/json"
16
+ }
17
+
18
+ space = { :workspace => { :name => "Space" } }
19
+
20
+ mock.get "/api/workspaces.json", headers, [ space ].to_json
21
+ mock.get "/api/workspaces/17.json", headers, space.to_json
22
+ end
11
23
  end
12
24
 
13
25
  def test_showing_workspace
14
26
  id = 17
15
- LiquidPlanner::LiquidPlannerResource.connection
16
- .expects(:get)
17
- .with(regexp_matches(/workspaces\/#{id}\.json$/), anything)
18
- .returns({})
19
-
20
- @lp.workspaces(id)
27
+
28
+ space = @lp.workspaces(id)
29
+
30
+ assert_equal "Space", space.name
21
31
  end
22
32
 
23
33
  def test_listing_workspaces
24
- LiquidPlanner::LiquidPlannerResource.connection
25
- .expects(:get)
26
- .with(regexp_matches(/workspaces\.json$/), anything)
27
- .returns([])
28
-
29
- @lp.workspaces
34
+ spaces = @lp.workspaces
35
+
36
+ assert_equal 1, spaces.length
37
+ assert_equal "Space", spaces.first.name
30
38
  end
31
- end
39
+ end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquidplanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
4
  prerelease:
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brett Bender
@@ -12,12 +12,21 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-08-27 00:00:00.000000000 Z
15
+ date: 2014-06-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: activeresource
19
- requirement: &54247400 !ruby/object:Gem::Requirement
18
+ type: :runtime
19
+ prerelease: false
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.0
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 3.0.0
20
28
  none: false
29
+ version_requirements: !ruby/object:Gem::Requirement
21
30
  requirements:
22
31
  - - ~>
23
32
  - !ruby/object:Gem::Version
@@ -25,13 +34,21 @@ dependencies:
25
34
  - - ! '>='
26
35
  - !ruby/object:Gem::Version
27
36
  version: 3.0.0
37
+ none: false
38
+ name: activeresource
39
+ - !ruby/object:Gem::Dependency
28
40
  type: :runtime
29
41
  prerelease: false
30
- version_requirements: *54247400
31
- - !ruby/object:Gem::Dependency
32
- name: activesupport
33
- requirement: &54246620 !ruby/object:Gem::Requirement
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.0
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: 3.0.0
34
50
  none: false
51
+ version_requirements: !ruby/object:Gem::Requirement
35
52
  requirements:
36
53
  - - ~>
37
54
  - !ruby/object:Gem::Version
@@ -39,13 +56,12 @@ dependencies:
39
56
  - - ! '>='
40
57
  - !ruby/object:Gem::Version
41
58
  version: 3.0.0
59
+ none: false
60
+ name: activesupport
61
+ - !ruby/object:Gem::Dependency
42
62
  type: :runtime
43
63
  prerelease: false
44
- version_requirements: *54246620
45
- - !ruby/object:Gem::Dependency
46
- name: multipart-post
47
- requirement: &54245620 !ruby/object:Gem::Requirement
48
- none: false
64
+ requirement: !ruby/object:Gem::Requirement
49
65
  requirements:
50
66
  - - ~>
51
67
  - !ruby/object:Gem::Version
@@ -53,31 +69,33 @@ dependencies:
53
69
  - - ! '>='
54
70
  - !ruby/object:Gem::Version
55
71
  version: 1.0.1
56
- type: :runtime
57
- prerelease: false
58
- version_requirements: *54245620
59
- - !ruby/object:Gem::Dependency
60
- name: highline
61
- requirement: &54244900 !ruby/object:Gem::Requirement
62
72
  none: false
73
+ version_requirements: !ruby/object:Gem::Requirement
63
74
  requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.1
64
78
  - - ! '>='
65
79
  - !ruby/object:Gem::Version
66
- version: '1.5'
80
+ version: 1.0.1
81
+ none: false
82
+ name: multipart-post
83
+ - !ruby/object:Gem::Dependency
67
84
  type: :development
68
85
  prerelease: false
69
- version_requirements: *54244900
70
- - !ruby/object:Gem::Dependency
71
- name: mocha
72
- requirement: &54244380 !ruby/object:Gem::Requirement
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '1.5'
73
91
  none: false
92
+ version_requirements: !ruby/object:Gem::Requirement
74
93
  requirements:
75
- - - =
94
+ - - ! '>='
76
95
  - !ruby/object:Gem::Version
77
- version: 0.9.8
78
- type: :development
79
- prerelease: false
80
- version_requirements: *54244380
96
+ version: '1.5'
97
+ none: false
98
+ name: highline
81
99
  description: LiquidPlanner API client
82
100
  email:
83
101
  - api@liquidplanner.com
@@ -96,6 +114,7 @@ files:
96
114
  - lib/liquidplanner/resources/root.rb
97
115
  - lib/liquidplanner/resources/member.rb
98
116
  - lib/liquidplanner/resources/inbox.rb
117
+ - lib/liquidplanner/resources/timesheet_entry.rb
99
118
  - lib/liquidplanner/resources/container.rb
100
119
  - lib/liquidplanner/resources/folder.rb
101
120
  - lib/liquidplanner/resources/custom_field_values.rb
@@ -141,20 +160,20 @@ rdoc_options: []
141
160
  require_paths:
142
161
  - lib
143
162
  required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
163
  requirements:
146
164
  - - ! '>='
147
165
  - !ruby/object:Gem::Version
148
166
  version: '0'
149
- required_rubygems_version: !ruby/object:Gem::Requirement
150
167
  none: false
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
169
  requirements:
152
170
  - - ! '>='
153
171
  - !ruby/object:Gem::Version
154
172
  version: '0'
173
+ none: false
155
174
  requirements: []
156
175
  rubyforge_project:
157
- rubygems_version: 1.8.11
176
+ rubygems_version: 1.8.23
158
177
  signing_key:
159
178
  specification_version: 3
160
179
  summary: LiquidPlanner API client