quilted-harvested 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.document +3 -0
  2. data/.gitignore +25 -0
  3. data/HISTORY +19 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +68 -0
  6. data/Rakefile +25 -0
  7. data/VERSION +1 -0
  8. data/examples/basics.rb +35 -0
  9. data/examples/clear_account.rb +28 -0
  10. data/examples/task_assignments.rb +27 -0
  11. data/examples/user_assignments.rb +24 -0
  12. data/features/account.feature +7 -0
  13. data/features/client_contacts.feature +23 -0
  14. data/features/clients.feature +29 -0
  15. data/features/errors.feature +25 -0
  16. data/features/expense_categories.feature +21 -0
  17. data/features/expenses.feature +55 -0
  18. data/features/hardy_client.feature +40 -0
  19. data/features/projects.feature +39 -0
  20. data/features/reporting.feature +72 -0
  21. data/features/step_definitions/account_steps.rb +7 -0
  22. data/features/step_definitions/assignment_steps.rb +100 -0
  23. data/features/step_definitions/contact_steps.rb +11 -0
  24. data/features/step_definitions/debug_steps.rb +3 -0
  25. data/features/step_definitions/error_steps.rb +113 -0
  26. data/features/step_definitions/expenses_steps.rb +46 -0
  27. data/features/step_definitions/harvest_steps.rb +8 -0
  28. data/features/step_definitions/model_steps.rb +90 -0
  29. data/features/step_definitions/people_steps.rb +4 -0
  30. data/features/step_definitions/report_steps.rb +91 -0
  31. data/features/step_definitions/time_entry_steps.rb +40 -0
  32. data/features/support/env.rb +37 -0
  33. data/features/support/error_helpers.rb +18 -0
  34. data/features/support/fixtures/empty_clients.xml +2 -0
  35. data/features/support/fixtures/over_limit.xml +8 -0
  36. data/features/support/fixtures/receipt.png +0 -0
  37. data/features/support/fixtures/under_limit.xml +8 -0
  38. data/features/support/harvest_credentials.example.yml +4 -0
  39. data/features/support/harvest_helpers.rb +11 -0
  40. data/features/support/inflections.rb +9 -0
  41. data/features/task_assignment.feature +69 -0
  42. data/features/tasks.feature +25 -0
  43. data/features/time_tracking.feature +29 -0
  44. data/features/user_assignments.feature +33 -0
  45. data/features/users.feature +55 -0
  46. data/harvested.gemspec +159 -0
  47. data/lib/harvest/api/account.rb +15 -0
  48. data/lib/harvest/api/base.rb +42 -0
  49. data/lib/harvest/api/clients.rb +10 -0
  50. data/lib/harvest/api/contacts.rb +19 -0
  51. data/lib/harvest/api/expense_categories.rb +9 -0
  52. data/lib/harvest/api/expenses.rb +28 -0
  53. data/lib/harvest/api/projects.rb +54 -0
  54. data/lib/harvest/api/reports.rb +39 -0
  55. data/lib/harvest/api/task_assignments.rb +32 -0
  56. data/lib/harvest/api/tasks.rb +9 -0
  57. data/lib/harvest/api/time.rb +32 -0
  58. data/lib/harvest/api/user_assignments.rb +32 -0
  59. data/lib/harvest/api/users.rb +21 -0
  60. data/lib/harvest/base.rb +258 -0
  61. data/lib/harvest/base_model.rb +73 -0
  62. data/lib/harvest/behavior/activatable.rb +31 -0
  63. data/lib/harvest/behavior/crud.rb +57 -0
  64. data/lib/harvest/client.rb +30 -0
  65. data/lib/harvest/contact.rb +29 -0
  66. data/lib/harvest/credentials.rb +21 -0
  67. data/lib/harvest/errors.rb +23 -0
  68. data/lib/harvest/expense.rb +19 -0
  69. data/lib/harvest/expense_category.rb +18 -0
  70. data/lib/harvest/hardy_client.rb +80 -0
  71. data/lib/harvest/project.rb +56 -0
  72. data/lib/harvest/rate_limit_status.rb +28 -0
  73. data/lib/harvest/task.rb +30 -0
  74. data/lib/harvest/task_assignment.rb +34 -0
  75. data/lib/harvest/time_entry.rb +42 -0
  76. data/lib/harvest/timezones.rb +149 -0
  77. data/lib/harvest/user.rb +66 -0
  78. data/lib/harvest/user_assignment.rb +34 -0
  79. data/lib/harvested.rb +62 -0
  80. data/spec/harvest/base_spec.rb +9 -0
  81. data/spec/harvest/credentials_spec.rb +22 -0
  82. data/spec/harvest/expense_spec.rb +15 -0
  83. data/spec/harvest/task_assignment_spec.rb +10 -0
  84. data/spec/harvest/time_entry_spec.rb +22 -0
  85. data/spec/harvest/user_assignment_spec.rb +10 -0
  86. data/spec/harvest/user_spec.rb +32 -0
  87. data/spec/spec.default.opts +1 -0
  88. data/spec/spec_helper.rb +10 -0
  89. metadata +264 -0
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Harvest::TimeEntry do
4
+ describe "#to_xml" do
5
+ it "should build a valid request xml" do
6
+ entry = Harvest::TimeEntry.new(:notes => 'the notes', :project_id => 'the project id', :task_id => 'the task id', :hours => 'the hours', :spent_at => '12/28/2009')
7
+ entry.to_xml.should == '<request><notes>the notes</notes><hours>the hours</hours><project_id>the project id</project_id><task_id>the task id</task_id><spent_at>Mon Dec 28 00:00:00 -0500 2009</spent_at></request>'
8
+ end
9
+ end
10
+
11
+ describe "#spent_at" do
12
+ it "should parse strings" do
13
+ entry = Harvest::TimeEntry.new(:spent_at => "12/01/2009")
14
+ entry.spent_at.should == Time.parse("12/01/2009")
15
+ end
16
+
17
+ it "should accept times" do
18
+ entry = Harvest::TimeEntry.new(:spent_at => Time.parse("12/01/2009"))
19
+ entry.spent_at.should == Time.parse("12/01/2009")
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,10 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Harvest::UserAssignment do
4
+ describe "#user_xml" do
5
+ it "should generate the xml for existing users" do
6
+ assignment = Harvest::UserAssignment.new(:user => mock(:user, :to_i => 3))
7
+ assignment.user_xml.should == '<user><id>3</id></user>'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Harvest::User do
4
+ describe "#timezone" do
5
+ it "should convert friendly timezone setting" do
6
+ p = Harvest::User.new(:timezone => :cst)
7
+ p.timezone.should == 'Central Time (US & Canada)'
8
+
9
+ p = Harvest::User.new(:timezone => :est)
10
+ p.timezone.should == 'Eastern Time (US & Canada)'
11
+
12
+ p = Harvest::User.new(:timezone => :mst)
13
+ p.timezone.should == 'Mountain Time (US & Canada)'
14
+
15
+ p = Harvest::User.new(:timezone => :pst)
16
+ p.timezone.should == 'Pacific Time (US & Canada)'
17
+
18
+ p = Harvest::User.new(:timezone => 'pst')
19
+ p.timezone.should == 'Pacific Time (US & Canada)'
20
+ end
21
+
22
+ it "should convert standard zones" do
23
+ p = Harvest::User.new(:timezone => 'america/chicago')
24
+ p.timezone.should == 'Central Time (US & Canada)'
25
+ end
26
+
27
+ it "should leave literal zones" do
28
+ p = Harvest::User.new(:timezone => 'Central Time (US & Canada)')
29
+ p.timezone.should == 'Central Time (US & Canada)'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require "rubygems"
4
+ require 'harvested'
5
+ require 'spec'
6
+ require 'spec/autorun'
7
+
8
+ Spec::Runner.configure do |config|
9
+
10
+ end
metadata ADDED
@@ -0,0 +1,264 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quilted-harvested
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 1
10
+ version: 0.3.1
11
+ platform: ruby
12
+ authors:
13
+ - Zach Moazeni, Michelle Moon Lee (updated)
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-20 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: cucumber
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: ruby-debug
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: fakeweb
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: httparty
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :runtime
92
+ version_requirements: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ name: happymapper
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :runtime
106
+ version_requirements: *id006
107
+ - !ruby/object:Gem::Dependency
108
+ name: builder
109
+ prerelease: false
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ type: :runtime
120
+ version_requirements: *id007
121
+ description: Harvested wraps the Harvest API concisely without the use of Rails dependencies. More information about the Harvest API can be found on their website (http://www.getharvest.com/api). For support hit up the Mailing List (http://groups.google.com/group/harvested)
122
+ email: michelle@quilted.coop
123
+ executables: []
124
+
125
+ extensions: []
126
+
127
+ extra_rdoc_files:
128
+ - README.md
129
+ files:
130
+ - .document
131
+ - .gitignore
132
+ - HISTORY
133
+ - MIT-LICENSE
134
+ - README.md
135
+ - Rakefile
136
+ - VERSION
137
+ - examples/basics.rb
138
+ - examples/clear_account.rb
139
+ - examples/task_assignments.rb
140
+ - examples/user_assignments.rb
141
+ - features/account.feature
142
+ - features/client_contacts.feature
143
+ - features/clients.feature
144
+ - features/errors.feature
145
+ - features/expense_categories.feature
146
+ - features/expenses.feature
147
+ - features/hardy_client.feature
148
+ - features/projects.feature
149
+ - features/reporting.feature
150
+ - features/step_definitions/account_steps.rb
151
+ - features/step_definitions/assignment_steps.rb
152
+ - features/step_definitions/contact_steps.rb
153
+ - features/step_definitions/debug_steps.rb
154
+ - features/step_definitions/error_steps.rb
155
+ - features/step_definitions/expenses_steps.rb
156
+ - features/step_definitions/harvest_steps.rb
157
+ - features/step_definitions/model_steps.rb
158
+ - features/step_definitions/people_steps.rb
159
+ - features/step_definitions/report_steps.rb
160
+ - features/step_definitions/time_entry_steps.rb
161
+ - features/support/env.rb
162
+ - features/support/error_helpers.rb
163
+ - features/support/fixtures/empty_clients.xml
164
+ - features/support/fixtures/over_limit.xml
165
+ - features/support/fixtures/receipt.png
166
+ - features/support/fixtures/under_limit.xml
167
+ - features/support/harvest_credentials.example.yml
168
+ - features/support/harvest_helpers.rb
169
+ - features/support/inflections.rb
170
+ - features/task_assignment.feature
171
+ - features/tasks.feature
172
+ - features/time_tracking.feature
173
+ - features/user_assignments.feature
174
+ - features/users.feature
175
+ - harvested.gemspec
176
+ - lib/harvest/api/account.rb
177
+ - lib/harvest/api/base.rb
178
+ - lib/harvest/api/clients.rb
179
+ - lib/harvest/api/contacts.rb
180
+ - lib/harvest/api/expense_categories.rb
181
+ - lib/harvest/api/expenses.rb
182
+ - lib/harvest/api/projects.rb
183
+ - lib/harvest/api/reports.rb
184
+ - lib/harvest/api/task_assignments.rb
185
+ - lib/harvest/api/tasks.rb
186
+ - lib/harvest/api/time.rb
187
+ - lib/harvest/api/user_assignments.rb
188
+ - lib/harvest/api/users.rb
189
+ - lib/harvest/base.rb
190
+ - lib/harvest/base_model.rb
191
+ - lib/harvest/behavior/activatable.rb
192
+ - lib/harvest/behavior/crud.rb
193
+ - lib/harvest/client.rb
194
+ - lib/harvest/contact.rb
195
+ - lib/harvest/credentials.rb
196
+ - lib/harvest/errors.rb
197
+ - lib/harvest/expense.rb
198
+ - lib/harvest/expense_category.rb
199
+ - lib/harvest/hardy_client.rb
200
+ - lib/harvest/project.rb
201
+ - lib/harvest/rate_limit_status.rb
202
+ - lib/harvest/task.rb
203
+ - lib/harvest/task_assignment.rb
204
+ - lib/harvest/time_entry.rb
205
+ - lib/harvest/timezones.rb
206
+ - lib/harvest/user.rb
207
+ - lib/harvest/user_assignment.rb
208
+ - lib/harvested.rb
209
+ - spec/harvest/base_spec.rb
210
+ - spec/harvest/credentials_spec.rb
211
+ - spec/harvest/expense_spec.rb
212
+ - spec/harvest/task_assignment_spec.rb
213
+ - spec/harvest/time_entry_spec.rb
214
+ - spec/harvest/user_assignment_spec.rb
215
+ - spec/harvest/user_spec.rb
216
+ - spec/spec.default.opts
217
+ - spec/spec_helper.rb
218
+ has_rdoc: true
219
+ homepage: http://github.com/quilted/harvested
220
+ licenses: []
221
+
222
+ post_install_message:
223
+ rdoc_options:
224
+ - --charset=UTF-8
225
+ require_paths:
226
+ - lib
227
+ required_ruby_version: !ruby/object:Gem::Requirement
228
+ none: false
229
+ requirements:
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ hash: 3
233
+ segments:
234
+ - 0
235
+ version: "0"
236
+ required_rubygems_version: !ruby/object:Gem::Requirement
237
+ none: false
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ hash: 3
242
+ segments:
243
+ - 0
244
+ version: "0"
245
+ requirements: []
246
+
247
+ rubyforge_project:
248
+ rubygems_version: 1.3.7
249
+ signing_key:
250
+ specification_version: 3
251
+ summary: A Ruby Wrapper for the Harvest API http://www.getharvest.com/
252
+ test_files:
253
+ - spec/harvest/base_spec.rb
254
+ - spec/harvest/credentials_spec.rb
255
+ - spec/harvest/expense_spec.rb
256
+ - spec/harvest/task_assignment_spec.rb
257
+ - spec/harvest/time_entry_spec.rb
258
+ - spec/harvest/user_assignment_spec.rb
259
+ - spec/harvest/user_spec.rb
260
+ - spec/spec_helper.rb
261
+ - examples/basics.rb
262
+ - examples/clear_account.rb
263
+ - examples/task_assignments.rb
264
+ - examples/user_assignments.rb