harvest-ruby-v2 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +117 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.rst +0 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/EXAMPLE.conf +4 -0
- data/Gemfile +39 -0
- data/LICENSE.txt +21 -0
- data/Makefile +9 -0
- data/README.md +44 -0
- data/Rakefile +34 -0
- data/bin/console +53 -0
- data/bin/setup +8 -0
- data/harvest-ruby-v2.gemspec +31 -0
- data/lib/harvest.rb +115 -0
- data/lib/harvest/client.rb +0 -0
- data/lib/harvest/config.rb +21 -0
- data/lib/harvest/creates.rb +46 -0
- data/lib/harvest/discovers.rb +58 -0
- data/lib/harvest/exceptions.rb +11 -0
- data/lib/harvest/finders.rb +17 -0
- data/lib/harvest/http/client.rb +0 -0
- data/lib/harvest/httpclient.rb +178 -0
- data/lib/harvest/resourcefactory.rb +220 -0
- data/lib/harvest/resources.rb +15 -0
- data/lib/harvest/resources/client.rb +34 -0
- data/lib/harvest/resources/company.rb +62 -0
- data/lib/harvest/resources/estimates.rb +173 -0
- data/lib/harvest/resources/expenses.rb +90 -0
- data/lib/harvest/resources/invoices.rb +262 -0
- data/lib/harvest/resources/message.rb +16 -0
- data/lib/harvest/resources/project.rb +84 -0
- data/lib/harvest/resources/project_assignment.rb +46 -0
- data/lib/harvest/resources/task.rb +35 -0
- data/lib/harvest/resources/task_assignment.rb +38 -0
- data/lib/harvest/resources/timeentry.rb +105 -0
- data/lib/harvest/resources/user.rb +75 -0
- data/lib/harvest/resources/user_assignment.rb +43 -0
- data/lib/harvest/version.rb +5 -0
- metadata +86 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Harvest
|
4
|
+
module Resources
|
5
|
+
# @param id [Integer]
|
6
|
+
# Unique ID for the expense category.
|
7
|
+
# @param name [String]
|
8
|
+
# The name of the expense category.
|
9
|
+
# @param unit_name [String]
|
10
|
+
# The unit name of the expense category.
|
11
|
+
# @param unit_price [decimal]
|
12
|
+
# The unit price of the expense category.
|
13
|
+
# @param is_active [Boolean]
|
14
|
+
# Whether the expense category is active or archived.
|
15
|
+
# @param created_at [DateTime]
|
16
|
+
# Date and time the expense category was created.
|
17
|
+
# @param updated_at [DateTime]
|
18
|
+
# Date and time the expense category was last updated.
|
19
|
+
ExpenseCategory = Struct.new(
|
20
|
+
'ExpenseCategory',
|
21
|
+
:id,
|
22
|
+
:name,
|
23
|
+
:unit_name,
|
24
|
+
:unit_price,
|
25
|
+
:is_active,
|
26
|
+
:created_at,
|
27
|
+
:updated_at,
|
28
|
+
keyword_init: true
|
29
|
+
)
|
30
|
+
|
31
|
+
# @param id [Integer]
|
32
|
+
# Unique ID for the expense.
|
33
|
+
# @param client [Struct]
|
34
|
+
# An object containing the expense's client id, name, and currency.
|
35
|
+
# @param project [Struct]
|
36
|
+
# An object containing the expense's project id, name, and code.
|
37
|
+
# @param expense_category [Struct]
|
38
|
+
# An object containing the expense's expense category id, name, unit_price,
|
39
|
+
# and unit_name.
|
40
|
+
# @param user [Struct]
|
41
|
+
# An object containing the id and name of the user that recorded the expense.
|
42
|
+
# @param user_assignment [Struct]
|
43
|
+
# A user assignment object of the user that recorded the expense.
|
44
|
+
# @param receipt [Struct]
|
45
|
+
# An object containing the expense's receipt URL and file name.
|
46
|
+
# @param invoice [Struct]
|
47
|
+
# Once the expense has been invoiced, this field will include the associated
|
48
|
+
# invoice's id and number.
|
49
|
+
# @param notes [String]
|
50
|
+
# Textual notes used to describe the expense.
|
51
|
+
# @param billable [Boolean]
|
52
|
+
# Whether the expense is billable or not.
|
53
|
+
# @param is_closed [Boolean]
|
54
|
+
# Whether the expense has been approved or closed for some other reason.
|
55
|
+
# @param is_locked [Boolean]
|
56
|
+
# Whether the expense has been been invoiced, approved, or the project or
|
57
|
+
# person related to the expense is archived.
|
58
|
+
# @param is_billed [Boolean]
|
59
|
+
# Whether or not the expense has been marked as invoiced.
|
60
|
+
# @param locked_reason [String]
|
61
|
+
# An explanation of why the expense has been locked.
|
62
|
+
# @param spent_date [Date]
|
63
|
+
# Date the expense occurred.
|
64
|
+
# @param created_at [DateTime]
|
65
|
+
# Date and time the expense was created.
|
66
|
+
# @param updated_at [DateTime]
|
67
|
+
# Date and time the expense was last updated.
|
68
|
+
Expense = Struct.new(
|
69
|
+
'Expense',
|
70
|
+
:id,
|
71
|
+
:client,
|
72
|
+
:project,
|
73
|
+
:expense_category,
|
74
|
+
:user,
|
75
|
+
:user_assignment,
|
76
|
+
:receipt,
|
77
|
+
:invoice,
|
78
|
+
:notes,
|
79
|
+
:billable,
|
80
|
+
:is_closed,
|
81
|
+
:is_locked,
|
82
|
+
:is_billed,
|
83
|
+
:locked_reason,
|
84
|
+
:spent_date,
|
85
|
+
:created_at,
|
86
|
+
:updated_at,
|
87
|
+
keyword_init: true
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Harvest
|
4
|
+
module Resources
|
5
|
+
# @param id [Integer]
|
6
|
+
# Unique ID for the invoice.
|
7
|
+
# @param client [Struct]
|
8
|
+
# An object containing invoice's client id and name.
|
9
|
+
# @param line_items [List]
|
10
|
+
# Array of invoice line items.
|
11
|
+
# @param estimate [Struct]
|
12
|
+
# An object containing the associated estimate's id.
|
13
|
+
# @param retainer [Struct]
|
14
|
+
# An object containing the associated retainer's id.
|
15
|
+
# @param creator [Struct]
|
16
|
+
# An object containing the id and name of the person that created the invoice.
|
17
|
+
# @param client_key [String]
|
18
|
+
# Used to build a URL to the public web invoice for your client:
|
19
|
+
# @param number [String]
|
20
|
+
# If no value is set, the number will be automatically generated.
|
21
|
+
# @param purchase_order [String]
|
22
|
+
# The purchase order number.
|
23
|
+
# @param amount [decimal]
|
24
|
+
# The total amount for the invoice, including any discounts and taxes.
|
25
|
+
# @param due_amount [decimal]
|
26
|
+
# The total amount due at this time for this invoice.
|
27
|
+
# @param tax [decimal]
|
28
|
+
# This percentage is applied to the subtotal, including line items and discounts.
|
29
|
+
# @param tax_amount [decimal]
|
30
|
+
# The first amount of tax included, calculated from tax. If no tax is
|
31
|
+
# defined, this value will be null.
|
32
|
+
# @param tax2 [decimal]
|
33
|
+
# This percentage is applied to the subtotal, including line items and discounts.
|
34
|
+
# @param tax2_amount [decimal]
|
35
|
+
# The amount calculated from tax2.
|
36
|
+
# @param discount [decimal]
|
37
|
+
# This percentage is subtracted from the subtotal.
|
38
|
+
# @param discount_amount [decimal]
|
39
|
+
# The amount calcuated from discount.
|
40
|
+
# @param subject [String]
|
41
|
+
# The invoice subject.
|
42
|
+
# @param notes [String]
|
43
|
+
# Any additional notes included on the invoice.
|
44
|
+
# @param currency [String]
|
45
|
+
# The currency code associated with this invoice.
|
46
|
+
# @param state [String]
|
47
|
+
# The current state of the invoice: draft, open, paid, or closed.
|
48
|
+
# @param period_start [Date]
|
49
|
+
# Start of the period during which time entries were added to this invoice.
|
50
|
+
# @param period_end [Date]
|
51
|
+
# End of the period during which time entries were added to this invoice.
|
52
|
+
# @param issue_date [Date]
|
53
|
+
# Date the invoice was issued.
|
54
|
+
# @param due_date [Date]
|
55
|
+
# Date the invoice is due.
|
56
|
+
# @param payment_term [String]
|
57
|
+
# The timeframe in which the invoice should be paid. Options: upon receipt,
|
58
|
+
# net 15, net 30, net 45, net 60, or custom.
|
59
|
+
# @param sent_at [DateTime]
|
60
|
+
# Date and time the invoice was sent.
|
61
|
+
# @param paid_at [DateTime]
|
62
|
+
# Date and time the invoice was paid.
|
63
|
+
# @param paid_date [Date]
|
64
|
+
# Date the invoice was paid.
|
65
|
+
# @param closed_at [DateTime]
|
66
|
+
# Date and time the invoice was closed.
|
67
|
+
# @param recurring_invoice_id [Integer]
|
68
|
+
# Unique ID of the associated recurring invoice.
|
69
|
+
# @param created_at [DateTime]
|
70
|
+
# Date and time the invoice was created.
|
71
|
+
# @param updated_at [DateTime]
|
72
|
+
# Date and time the invoice was last updated.
|
73
|
+
Invoice = Struct.new(
|
74
|
+
'Invoice',
|
75
|
+
:id,
|
76
|
+
:client,
|
77
|
+
:line_items,
|
78
|
+
:estimate,
|
79
|
+
:retainer,
|
80
|
+
:creator,
|
81
|
+
:client_key,
|
82
|
+
:number,
|
83
|
+
:purchase_order,
|
84
|
+
:amount,
|
85
|
+
:due_amount,
|
86
|
+
:tax,
|
87
|
+
:tax_amount,
|
88
|
+
:tax2,
|
89
|
+
:tax2_amount,
|
90
|
+
:discount,
|
91
|
+
:discount_amount,
|
92
|
+
:subject,
|
93
|
+
:notes,
|
94
|
+
:currency,
|
95
|
+
:state,
|
96
|
+
:period_start,
|
97
|
+
:period_end,
|
98
|
+
:issue_date,
|
99
|
+
:due_date,
|
100
|
+
:payment_term,
|
101
|
+
:sent_at,
|
102
|
+
:paid_at,
|
103
|
+
:paid_date,
|
104
|
+
:closed_at,
|
105
|
+
:recurring_invoice_id,
|
106
|
+
:created_at,
|
107
|
+
:updated_at,
|
108
|
+
keyword_init: true
|
109
|
+
)
|
110
|
+
|
111
|
+
# @param id [Integer]
|
112
|
+
# Unique ID for the line item.
|
113
|
+
# @param project [Struct]
|
114
|
+
# An object containing the associated project's id, name, and code.
|
115
|
+
# @param kind [String]
|
116
|
+
# The name of an invoice item category.
|
117
|
+
# @param description [String]
|
118
|
+
# Text description of the line item.
|
119
|
+
# @param quantity [decimal]
|
120
|
+
# The unit quantity of the item.
|
121
|
+
# @param unit_price [decimal]
|
122
|
+
# The individual price per unit.
|
123
|
+
# @param amount [decimal]
|
124
|
+
# The line item subtotal (quantity * unit_price).
|
125
|
+
# @param taxed [Boolean]
|
126
|
+
# Whether the invoice's tax percentage applies to this line item.
|
127
|
+
# @param taxed2 [Boolean]
|
128
|
+
# Whether the invoice's tax2 percentage applies to this line item.
|
129
|
+
InvoiceLineItem = Struct.new(
|
130
|
+
'InvoiceLineItem',
|
131
|
+
:id,
|
132
|
+
:project,
|
133
|
+
:kind,
|
134
|
+
:description,
|
135
|
+
:quantity,
|
136
|
+
:unit_price,
|
137
|
+
:amount,
|
138
|
+
:taxed,
|
139
|
+
:taxed2,
|
140
|
+
keyword_init: true
|
141
|
+
)
|
142
|
+
|
143
|
+
# @param id [Integer]
|
144
|
+
# Unique ID for the message.
|
145
|
+
# @param sent_by [String]
|
146
|
+
# Name of the user that created the message.
|
147
|
+
# @param sent_by_email [String]
|
148
|
+
# Email of the user that created the message.
|
149
|
+
# @param sent_from [String]
|
150
|
+
# Name of the user that the message was sent from.
|
151
|
+
# @param sent_from_email [String]
|
152
|
+
# Email of the user that message was sent from.
|
153
|
+
# @param recipients [List]
|
154
|
+
# Array of invoice message recipients.
|
155
|
+
# @param subject [String]
|
156
|
+
# The message subject.
|
157
|
+
# @param body [String]
|
158
|
+
# The message body.
|
159
|
+
# @param include_link_to_client_invoice [Boolean]
|
160
|
+
# Whether to include a link to the client invoice in the message body. Not
|
161
|
+
# used when thank_you is true.
|
162
|
+
# @param attach_pdf [Boolean]
|
163
|
+
# Whether to attach the invoice PDF to the message email.
|
164
|
+
# @param send_me_a_copy [Boolean]
|
165
|
+
# Whether to email a copy of the message to the current user.
|
166
|
+
# @param thank_you [Boolean]
|
167
|
+
# Whether this is a thank you message.
|
168
|
+
# @param event_type [String]
|
169
|
+
# The type of invoice event that occurred with the message: send, close,
|
170
|
+
# draft, re-open, or view.
|
171
|
+
# @param reminder [Boolean]
|
172
|
+
# Whether this is a reminder message.
|
173
|
+
# @param send_reminder_on [Date]
|
174
|
+
# The Date the reminder email will be sent.
|
175
|
+
# @param created_at [DateTime]
|
176
|
+
# Date and time the message was created.
|
177
|
+
# @param updated_at [DateTime]
|
178
|
+
# Date and time the message was last updated.
|
179
|
+
InvoiceMessage = Struct.new(
|
180
|
+
'InvoiceMessage',
|
181
|
+
:id,
|
182
|
+
:sent_by,
|
183
|
+
:sent_by_email,
|
184
|
+
:sent_from,
|
185
|
+
:sent_from_email,
|
186
|
+
:recipients,
|
187
|
+
:subject,
|
188
|
+
:body,
|
189
|
+
:include_link_to_client_invoice,
|
190
|
+
:attach_pdf,
|
191
|
+
:send_me_a_copy,
|
192
|
+
:thank_you,
|
193
|
+
:event_type,
|
194
|
+
:reminder,
|
195
|
+
:send_reminder_on,
|
196
|
+
:created_at,
|
197
|
+
:updated_at,
|
198
|
+
keyword_init: true
|
199
|
+
)
|
200
|
+
|
201
|
+
# @param id [Integer]
|
202
|
+
# Unique ID for the payment.
|
203
|
+
# @param amount [decimal]
|
204
|
+
# The amount of the payment.
|
205
|
+
# @param paid_at [DateTime]
|
206
|
+
# Date and time the payment was made.
|
207
|
+
# @param paid_date [Date]
|
208
|
+
# Date the payment was made.
|
209
|
+
# @param recorded_by [String]
|
210
|
+
# The name of the person who recorded the payment.
|
211
|
+
# @param recorded_by_email [String]
|
212
|
+
# The email of the person who recorded the payment.
|
213
|
+
# @param notes [String]
|
214
|
+
# Any notes associated with the payment.
|
215
|
+
# @param transaction_id [String]
|
216
|
+
# Either the card authorization or PayPal transaction ID.
|
217
|
+
# @param payment_gateway [Struct]
|
218
|
+
# The payment gateway id and name used to process the payment.
|
219
|
+
# @param created_at [DateTime]
|
220
|
+
# Date and time the payment was recorded.
|
221
|
+
# @param updated_at [DateTime]
|
222
|
+
# Date and time the payment was last updated.
|
223
|
+
InvoicePayment = Struct.new(
|
224
|
+
'InvoicePayment',
|
225
|
+
:id,
|
226
|
+
:amount,
|
227
|
+
:paid_at,
|
228
|
+
:paid_date,
|
229
|
+
:recorded_by,
|
230
|
+
:recorded_by_email,
|
231
|
+
:notes,
|
232
|
+
:transaction_id,
|
233
|
+
:payment_gateway,
|
234
|
+
:created_at,
|
235
|
+
:updated_at,
|
236
|
+
keyword_init: true
|
237
|
+
)
|
238
|
+
|
239
|
+
# @param id [Integer]
|
240
|
+
# Unique ID for the invoice item category.
|
241
|
+
# @param name [String]
|
242
|
+
# The name of the invoice item category.
|
243
|
+
# @param use_as_service [Boolean]
|
244
|
+
# Whether this invoice item category is used for billable hours when generating an invoice.
|
245
|
+
# @param use_as_expense [Boolean]
|
246
|
+
# Whether this invoice item category is used for expenses when generating an invoice.
|
247
|
+
# @param created_at [DateTime]
|
248
|
+
# Date and time the invoice item category was created.
|
249
|
+
# @param updated_at [DateTime]
|
250
|
+
# Date and time the invoice item category was last updated.
|
251
|
+
InvoiceItemCategory = Struct.new(
|
252
|
+
'InvoiceItemCategory',
|
253
|
+
:id,
|
254
|
+
:name,
|
255
|
+
:use_as_service,
|
256
|
+
:use_as_expense,
|
257
|
+
:created_at,
|
258
|
+
:updated_at,
|
259
|
+
keyword_init: true
|
260
|
+
)
|
261
|
+
end
|
262
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Harvest
|
4
|
+
module Resources
|
5
|
+
# @param name [String]
|
6
|
+
# Name of the message recipient.
|
7
|
+
# @param email [String]
|
8
|
+
# Email of the message recipient.
|
9
|
+
MessageRecipient = Struct.new(
|
10
|
+
'MessageRecipient',
|
11
|
+
:name,
|
12
|
+
:email,
|
13
|
+
keyword_init: true
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Harvest
|
4
|
+
module Resources
|
5
|
+
# https://help.getharvest.com/api-v2/projects-api/projects/projects/
|
6
|
+
# @param id [Integer]
|
7
|
+
# Unique ID for the project.
|
8
|
+
# @param client [Struct]
|
9
|
+
# An object containing the project's client id, name, and currency.
|
10
|
+
# @param name [String]
|
11
|
+
# Unique name for the project.
|
12
|
+
# @param code [String]
|
13
|
+
# The code associated with the project.
|
14
|
+
# @param is_active [Boolean]
|
15
|
+
# Whether the project is active or archived.
|
16
|
+
# @param is_billable [Boolean]
|
17
|
+
# Whether the project is billable or not.
|
18
|
+
# @param is_fixed_fee [Boolean]
|
19
|
+
# Whether the project is a fixed-fee project or not.
|
20
|
+
# @param bill_by [String]
|
21
|
+
# The method by which the project is invoiced.
|
22
|
+
# @param hourly_rate [decimal]
|
23
|
+
# Rate for projects billed by Project Hourly Rate.
|
24
|
+
# @param budget [decimal]
|
25
|
+
# The budget in hours for the project when budgeting by time.
|
26
|
+
# @param budget_by [String]
|
27
|
+
# The method by which the project is budgeted.
|
28
|
+
# @param budget_is_monthly [Boolean]
|
29
|
+
# Option to have the budget reset every month.
|
30
|
+
# @param notify_when_over_budget [Boolean]
|
31
|
+
# Whether Project Managers should be notified when the project goes over budget.
|
32
|
+
# @param over_budget_notification_percentage [decimal]
|
33
|
+
# Percentage value used to trigger over budget email alerts.
|
34
|
+
# @param over_budget_notification_date [Date]
|
35
|
+
# Date of last over budget notification. If none have been sent, this will be null.
|
36
|
+
# @param show_budget_to_all [Boolean]
|
37
|
+
# Option to show project budget to all employees. Does not apply to Total Project Fee projects.
|
38
|
+
# @param cost_budget [decimal]
|
39
|
+
# The monetary budget for the project when budgeting by money.
|
40
|
+
# @param cost_budget_include_expenses [Boolean]
|
41
|
+
# Option for budget of Total Project Fees projects to include tracked expenses.
|
42
|
+
# @param fee [decimal]
|
43
|
+
# The amount you plan to invoice for the project. Only used by fixed-fee projects.
|
44
|
+
# @param notes [String]
|
45
|
+
# Project notes.
|
46
|
+
# @param starts_on [Date]
|
47
|
+
# Date the project was started.
|
48
|
+
# @param ends_on [Date]
|
49
|
+
# Date the project will end.
|
50
|
+
# @param created_at [DateTime]
|
51
|
+
# Date and time the project was created.
|
52
|
+
# @param updated_at [DateTime]
|
53
|
+
# Date and time the project was last updated.
|
54
|
+
Project = Struct.new(
|
55
|
+
'Project',
|
56
|
+
:bill_by,
|
57
|
+
:budget,
|
58
|
+
:budget_by,
|
59
|
+
:budget_is_monthly,
|
60
|
+
:client,
|
61
|
+
:code,
|
62
|
+
:cost_budget,
|
63
|
+
:cost_budget_include_expenses,
|
64
|
+
:created_at,
|
65
|
+
:ends_on,
|
66
|
+
:fee,
|
67
|
+
:hourly_rate,
|
68
|
+
:id,
|
69
|
+
:is_active,
|
70
|
+
:is_billable,
|
71
|
+
:is_fixed_fee,
|
72
|
+
:name,
|
73
|
+
:notes,
|
74
|
+
:notify_when_over_budget,
|
75
|
+
:over_budget_notification_date,
|
76
|
+
:over_budget_notification_percentage,
|
77
|
+
:show_budget_to_all,
|
78
|
+
:starts_on,
|
79
|
+
:updated_at,
|
80
|
+
:task_assignments,
|
81
|
+
keyword_init: true
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|