harvested 0.3.3 → 0.4.0
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.
- data/Gemfile +15 -0
- data/HISTORY +11 -0
- data/README.md +14 -6
- data/Rakefile +13 -31
- data/TODO +2 -0
- data/VERSION +1 -1
- data/examples/user_assignments.rb +1 -1
- data/harvested.gemspec +114 -126
- data/lib/ext/array.rb +52 -0
- data/lib/ext/date.rb +9 -0
- data/lib/ext/hash.rb +17 -0
- data/lib/ext/time.rb +5 -0
- data/lib/harvest/api/account.rb +8 -1
- data/lib/harvest/api/base.rb +32 -10
- data/lib/harvest/api/contacts.rb +1 -1
- data/lib/harvest/api/expenses.rb +3 -4
- data/lib/harvest/api/invoice_categories.rb +26 -0
- data/lib/harvest/api/invoices.rb +16 -0
- data/lib/harvest/api/projects.rb +2 -10
- data/lib/harvest/api/reports.rb +13 -16
- data/lib/harvest/api/task_assignments.rb +8 -6
- data/lib/harvest/api/tasks.rb +1 -1
- data/lib/harvest/api/time.rb +13 -13
- data/lib/harvest/api/user_assignments.rb +7 -5
- data/lib/harvest/base.rb +9 -1
- data/lib/harvest/behavior/activatable.rb +2 -2
- data/lib/harvest/behavior/crud.rb +15 -13
- data/lib/harvest/client.rb +18 -13
- data/lib/harvest/contact.rb +13 -11
- data/lib/harvest/errors.rb +6 -4
- data/lib/harvest/expense.rb +40 -14
- data/lib/harvest/expense_category.rb +10 -9
- data/lib/harvest/hardy_client.rb +1 -1
- data/lib/harvest/invoice.rb +103 -0
- data/lib/harvest/invoice_category.rb +18 -0
- data/lib/harvest/line_item.rb +12 -0
- data/lib/harvest/model.rb +120 -0
- data/lib/harvest/project.rb +55 -26
- data/lib/harvest/rate_limit_status.rb +9 -8
- data/lib/harvest/task.rb +17 -14
- data/lib/harvest/task_assignment.rb +27 -22
- data/lib/harvest/time_entry.rb +32 -30
- data/lib/harvest/user.rb +46 -22
- data/lib/harvest/user_assignment.rb +24 -17
- data/lib/harvested.rb +12 -5
- data/spec/functional/account_spec.rb +17 -0
- data/spec/functional/clients_spec.rb +58 -0
- data/spec/functional/errors_spec.rb +22 -0
- data/spec/functional/expenses_spec.rb +84 -0
- data/spec/functional/hardy_client_spec.rb +33 -0
- data/spec/functional/invoice_spec.rb +67 -0
- data/spec/functional/project_spec.rb +50 -0
- data/spec/functional/reporting_spec.rb +80 -0
- data/spec/functional/tasks_spec.rb +88 -0
- data/spec/functional/time_tracking_spec.rb +53 -0
- data/spec/functional/users_spec.rb +102 -0
- data/spec/harvest/base_spec.rb +1 -1
- data/spec/harvest/credentials_spec.rb +1 -1
- data/spec/harvest/expense_category_spec.rb +5 -0
- data/spec/harvest/expense_spec.rb +8 -5
- data/spec/harvest/invoice_spec.rb +47 -0
- data/spec/harvest/project_spec.rb +11 -0
- data/spec/harvest/task_assignment_spec.rb +4 -4
- data/spec/harvest/task_spec.rb +7 -0
- data/spec/harvest/time_entry_spec.rb +11 -10
- data/spec/harvest/user_assignment_spec.rb +3 -3
- data/spec/harvest/user_spec.rb +3 -1
- data/spec/spec_helper.rb +37 -6
- data/{features → spec}/support/harvest_credentials.example.yml +0 -1
- data/spec/support/harvested_helpers.rb +44 -0
- data/spec/support/json_examples.rb +11 -0
- data/spec/test_rubies +5 -0
- metadata +109 -85
- data/.gitignore +0 -28
- data/features/account.feature +0 -7
- data/features/client_contacts.feature +0 -23
- data/features/clients.feature +0 -29
- data/features/errors.feature +0 -25
- data/features/expense_categories.feature +0 -21
- data/features/expenses.feature +0 -55
- data/features/hardy_client.feature +0 -40
- data/features/projects.feature +0 -39
- data/features/reporting.feature +0 -72
- data/features/step_definitions/account_steps.rb +0 -7
- data/features/step_definitions/assignment_steps.rb +0 -100
- data/features/step_definitions/contact_steps.rb +0 -11
- data/features/step_definitions/debug_steps.rb +0 -3
- data/features/step_definitions/error_steps.rb +0 -113
- data/features/step_definitions/expenses_steps.rb +0 -46
- data/features/step_definitions/harvest_steps.rb +0 -8
- data/features/step_definitions/model_steps.rb +0 -90
- data/features/step_definitions/people_steps.rb +0 -4
- data/features/step_definitions/report_steps.rb +0 -91
- data/features/step_definitions/time_entry_steps.rb +0 -40
- data/features/support/env.rb +0 -37
- data/features/support/error_helpers.rb +0 -18
- data/features/support/fixtures/empty_clients.xml +0 -2
- data/features/support/fixtures/over_limit.xml +0 -8
- data/features/support/fixtures/receipt.png +0 -0
- data/features/support/fixtures/under_limit.xml +0 -8
- data/features/support/harvest_helpers.rb +0 -11
- data/features/support/inflections.rb +0 -9
- data/features/task_assignment.feature +0 -69
- data/features/tasks.feature +0 -25
- data/features/time_tracking.feature +0 -29
- data/features/user_assignments.feature +0 -33
- data/features/users.feature +0 -55
- data/lib/harvest/base_model.rb +0 -73
- data/spec/spec.default.opts +0 -1
data/features/tasks.feature
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
@clean
|
2
|
-
Feature: Managing Tasks
|
3
|
-
|
4
|
-
Scenario: Adding, Updating, and Removing a Task
|
5
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
6
|
-
When I create a task with the following:
|
7
|
-
| name | Test Task |
|
8
|
-
| billable | true |
|
9
|
-
| deactivated | false |
|
10
|
-
| hourly_rate | 120 |
|
11
|
-
Then there should be a task "Test Task"
|
12
|
-
When I update the task "Test Task" with the following:
|
13
|
-
| name | Updated Task |
|
14
|
-
| hourly_rate | 100.0 |
|
15
|
-
| deactivated | true |
|
16
|
-
| billable | false |
|
17
|
-
| default | true |
|
18
|
-
Then the task "Updated Task" should have the following attributes:
|
19
|
-
| hourly_rate | 100.0 |
|
20
|
-
| deactivated | true |
|
21
|
-
| active? | false |
|
22
|
-
| billable | false |
|
23
|
-
| default? | true |
|
24
|
-
When I delete the task "Updated Task"
|
25
|
-
Then there should not be a task "Updated Task"
|
@@ -1,29 +0,0 @@
|
|
1
|
-
@clean
|
2
|
-
Feature: Time Tracking
|
3
|
-
|
4
|
-
Scenario: Adding, Updating, and Deleting Time Entries
|
5
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
6
|
-
And I create a client with the following:
|
7
|
-
| name | Time Client |
|
8
|
-
| details | Client to track time against |
|
9
|
-
And I create a project for the client "Time Client" with the following:
|
10
|
-
| name | Time Project |
|
11
|
-
| active | true |
|
12
|
-
And I create a task with the following:
|
13
|
-
| name | Time Task |
|
14
|
-
| billable | true |
|
15
|
-
| hourly_rate | 120 |
|
16
|
-
And I assign the task "Time Task" to the project "Time Project"
|
17
|
-
When I create a time entry for the project "Time Project" and the task "Time Task" with the following:
|
18
|
-
| notes | Test api support |
|
19
|
-
| hours | 3.0 |
|
20
|
-
| spent_at | 12/28/2009 |
|
21
|
-
Then there should be a time entry "Test api support" on "12/28/2009"
|
22
|
-
When I update the time entry "Test api support" on "12/28/2009" with the following:
|
23
|
-
| hours | 4.0 |
|
24
|
-
Then the time entry "Test api support" on "12/28/2009" should have the following attributes:
|
25
|
-
| hours | 4.0 |
|
26
|
-
When I delete the time entry "Test api support" on "12/28/2009"
|
27
|
-
Then there should not be a time entry "Test api support" on "12/28/2009"
|
28
|
-
|
29
|
-
Scenario: Toggling Timers
|
@@ -1,33 +0,0 @@
|
|
1
|
-
@clean
|
2
|
-
Feature: User Assignments
|
3
|
-
|
4
|
-
Scenario: Adding and Updating a User on a Project
|
5
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
6
|
-
When I create a client with the following:
|
7
|
-
| name | Client Projects |
|
8
|
-
| details | Building API Widgets across the country |
|
9
|
-
When I create a project for the client "Client Projects" with the following:
|
10
|
-
| name | Test Project |
|
11
|
-
| active | true |
|
12
|
-
| notes | project to test the api |
|
13
|
-
Then there should be a project "Test Project"
|
14
|
-
When I create a user with the following:
|
15
|
-
| first_name | Edgar |
|
16
|
-
| last_name | Ruth |
|
17
|
-
| email | edgar@ruth.com |
|
18
|
-
| password | mypassword |
|
19
|
-
| password_confirmation | mypassword |
|
20
|
-
Then there should be a user "edgar@ruth.com"
|
21
|
-
When I assign the user "edgar@ruth.com" to the project "Test Project"
|
22
|
-
Then the user "edgar@ruth.com" should be assigned to the project "Test Project"
|
23
|
-
When I update the user "edgar@ruth.com" on the project "Test Project" with the following:
|
24
|
-
| hourly_rate | 50.0 |
|
25
|
-
| project_manager | true |
|
26
|
-
Then the user "edgar@ruth.com" on the project "Test Project" should have the following attributes:
|
27
|
-
| active? | true |
|
28
|
-
| hourly_rate | 50.0 |
|
29
|
-
| project_manager | true |
|
30
|
-
When I remove the user "edgar@ruth.com" from the project "Test Project"
|
31
|
-
Then the user "edgar@ruth.com" should not be assigned to the project "Test Project"
|
32
|
-
|
33
|
-
Scenario: Removing a user from a project that has recorded hours
|
data/features/users.feature
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
@clean
|
2
|
-
Feature: Managing People
|
3
|
-
|
4
|
-
Scenario: Adding and Removing a User
|
5
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
6
|
-
When I create a user with the following:
|
7
|
-
| first_name | Edgar |
|
8
|
-
| last_name | Ruth |
|
9
|
-
| email | edgar@ruth.com |
|
10
|
-
| password | mypassword |
|
11
|
-
| password_confirmation | mypassword |
|
12
|
-
| timezone | cst |
|
13
|
-
| admin | false |
|
14
|
-
| telephone | 444-4444 |
|
15
|
-
Then there should be a user "edgar@ruth.com"
|
16
|
-
When I update the user "edgar@ruth.com" with the following:
|
17
|
-
| first_name | Jonah |
|
18
|
-
| timezone | pst |
|
19
|
-
Then the user "edgar@ruth.com" should have the following attributes:
|
20
|
-
| first_name | Jonah |
|
21
|
-
| timezone | Pacific Time (US & Canada) |
|
22
|
-
When I delete the user "edgar@ruth.com"
|
23
|
-
Then there should not be a user "edgar@ruth.com"
|
24
|
-
|
25
|
-
Scenario: Activating and Deactivating a User
|
26
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
27
|
-
Then I create a user with the following:
|
28
|
-
| first_name | Simon |
|
29
|
-
| last_name | Steel |
|
30
|
-
| email | simon@steel.com |
|
31
|
-
| password | mypassword |
|
32
|
-
| password_confirmation | mypassword |
|
33
|
-
| timezone | cst |
|
34
|
-
| admin | false |
|
35
|
-
| telephone | 444-4444 |
|
36
|
-
Then the user "simon@steel.com" should be activated
|
37
|
-
When I deactivate the user "simon@steel.com"
|
38
|
-
Then the user "simon@steel.com" should be deactivated
|
39
|
-
When I activate the user "simon@steel.com"
|
40
|
-
Then the user "simon@steel.com" should be activated
|
41
|
-
Then I delete the user "simon@steel.com"
|
42
|
-
|
43
|
-
Scenario: Resetting a User's password
|
44
|
-
Given I am using the credentials from "./support/harvest_credentials.yml"
|
45
|
-
Then I create a user with the following:
|
46
|
-
| first_name | Edgar |
|
47
|
-
| last_name | Ruth |
|
48
|
-
| email | edgar@ruth.com |
|
49
|
-
| password | mypassword |
|
50
|
-
| password_confirmation | mypassword |
|
51
|
-
| timezone | cst |
|
52
|
-
| admin | false |
|
53
|
-
| telephone | 444-4444 |
|
54
|
-
Then there should be a user "edgar@ruth.com"
|
55
|
-
Then I reset the password of "edgar@ruth.com"
|
data/lib/harvest/base_model.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
module Harvest
|
2
|
-
# The parent class of all Harvest models. Contains useful inheritable methods
|
3
|
-
class BaseModel
|
4
|
-
|
5
|
-
# Initializes the model. You can pass the attributes as a hash in a ActiveRecord-like style
|
6
|
-
#
|
7
|
-
# == Examples
|
8
|
-
# client = Harvest::Client.new(:name => 'John Doe')
|
9
|
-
# client.name # returns 'John Doe'
|
10
|
-
def initialize(attributes = {})
|
11
|
-
self.attributes = attributes
|
12
|
-
end
|
13
|
-
|
14
|
-
# Given a hash, sets the corresponding attributes
|
15
|
-
#
|
16
|
-
# == Examples
|
17
|
-
# client = Harvest::Client.new(:name => 'John Doe')
|
18
|
-
# client.name # returns 'John Doe'
|
19
|
-
# client.attributes = {:name => 'Terry Vaughn'}
|
20
|
-
# client.name # returns 'Terry Vaughn'
|
21
|
-
#
|
22
|
-
# @return [void]
|
23
|
-
def attributes=(attributes)
|
24
|
-
attributes.each {|k,v| send("#{k}=", v)}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Checks the equality of another model based on the id
|
28
|
-
#
|
29
|
-
# == Examples
|
30
|
-
# client1 = Harvest::Client.new(:id => 1)
|
31
|
-
# client2 = Harvest::Client.new(:id => 1)
|
32
|
-
# client3 = Harvest::Client.new(:id => 2)
|
33
|
-
#
|
34
|
-
# client1 == client2 # returns true
|
35
|
-
# client1 == client3 # returns false
|
36
|
-
#
|
37
|
-
# @return [Boolean]
|
38
|
-
def ==(other)
|
39
|
-
id == other.id
|
40
|
-
end
|
41
|
-
|
42
|
-
# Returns the id of the model
|
43
|
-
#
|
44
|
-
# == Examples
|
45
|
-
# client = Harvest::Client.new(:id => 1)
|
46
|
-
# client.to_i # returns 1
|
47
|
-
#
|
48
|
-
# @return [Fixnum]
|
49
|
-
def to_i
|
50
|
-
id
|
51
|
-
end
|
52
|
-
|
53
|
-
# Builds the XML of the model. Primarily used to interact with the Harvest API.
|
54
|
-
#
|
55
|
-
# @return [String]
|
56
|
-
def to_xml
|
57
|
-
builder = Builder::XmlMarkup.new
|
58
|
-
builder.tag!(self.class.tag_name) do |c|
|
59
|
-
self.class.elements.each do |f|
|
60
|
-
c.tag!(f.tag, send(f.name)) if send(f.name)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
class << self
|
66
|
-
# This sets the API path so the API collections can use them in an agnostic way
|
67
|
-
# @return [void]
|
68
|
-
def api_path(path = nil)
|
69
|
-
@path ||= path
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
data/spec/spec.default.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|