moneybird-client 0.12.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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +26 -0
- data/.forgejo/workflows/release.yml +56 -0
- data/.forgejo/workflows/ruby.yml +37 -0
- data/.gitignore +10 -0
- data/.kick +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1156 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +11 -0
- data/bin/console +13 -0
- data/bin/setup +8 -0
- data/lib/moneybird/client.rb +80 -0
- data/lib/moneybird/http_error/authorization_required.rb +8 -0
- data/lib/moneybird/http_error/bad_request.rb +8 -0
- data/lib/moneybird/http_error/forbidden.rb +8 -0
- data/lib/moneybird/http_error/internal_server_error.rb +8 -0
- data/lib/moneybird/http_error/method_not_allowed.rb +8 -0
- data/lib/moneybird/http_error/not_accepted.rb +8 -0
- data/lib/moneybird/http_error/not_found.rb +8 -0
- data/lib/moneybird/http_error/payment_required.rb +8 -0
- data/lib/moneybird/http_error/too_many_requests.rb +8 -0
- data/lib/moneybird/http_error/unprocessable_entity.rb +8 -0
- data/lib/moneybird/middleware/error_handling.rb +29 -0
- data/lib/moneybird/middleware/pagination/links.rb +19 -0
- data/lib/moneybird/middleware/pagination.rb +31 -0
- data/lib/moneybird/oauth.rb +91 -0
- data/lib/moneybird/resource/administration.rb +101 -0
- data/lib/moneybird/resource/contact.rb +75 -0
- data/lib/moneybird/resource/custom_field.rb +18 -0
- data/lib/moneybird/resource/document_style.rb +35 -0
- data/lib/moneybird/resource/documents/general_document.rb +27 -0
- data/lib/moneybird/resource/documents/general_journal_document.rb +28 -0
- data/lib/moneybird/resource/documents/purchase_invoice.rb +57 -0
- data/lib/moneybird/resource/documents/receipt.rb +57 -0
- data/lib/moneybird/resource/documents/typeless_document.rb +28 -0
- data/lib/moneybird/resource/estimate.rb +64 -0
- data/lib/moneybird/resource/external_sales_invoice.rb +61 -0
- data/lib/moneybird/resource/financial_account.rb +23 -0
- data/lib/moneybird/resource/financial_mutation.rb +39 -0
- data/lib/moneybird/resource/generic/event.rb +19 -0
- data/lib/moneybird/resource/generic/note.rb +25 -0
- data/lib/moneybird/resource/identity.rb +31 -0
- data/lib/moneybird/resource/invoice/details.rb +29 -0
- data/lib/moneybird/resource/invoice/payment.rb +26 -0
- data/lib/moneybird/resource/ledger_account.rb +19 -0
- data/lib/moneybird/resource/product.rb +21 -0
- data/lib/moneybird/resource/recurring_sales_invoice.rb +62 -0
- data/lib/moneybird/resource/sales_invoice.rb +98 -0
- data/lib/moneybird/resource/synchronization.rb +15 -0
- data/lib/moneybird/resource/tax_rate.rb +21 -0
- data/lib/moneybird/resource/webhook.rb +24 -0
- data/lib/moneybird/resource/workflow.rb +24 -0
- data/lib/moneybird/resource.rb +126 -0
- data/lib/moneybird/service/administration.rb +29 -0
- data/lib/moneybird/service/contact.rb +27 -0
- data/lib/moneybird/service/custom_field.rb +19 -0
- data/lib/moneybird/service/document_style.rb +19 -0
- data/lib/moneybird/service/documents/general_document.rb +23 -0
- data/lib/moneybird/service/documents/general_journal_document.rb +23 -0
- data/lib/moneybird/service/documents/purchase_invoice.rb +23 -0
- data/lib/moneybird/service/documents/receipt.rb +23 -0
- data/lib/moneybird/service/documents/typeless_document.rb +23 -0
- data/lib/moneybird/service/estimate.rb +23 -0
- data/lib/moneybird/service/external_sales_invoice.rb +22 -0
- data/lib/moneybird/service/financial_account.rb +19 -0
- data/lib/moneybird/service/financial_mutation.rb +24 -0
- data/lib/moneybird/service/identity.rb +22 -0
- data/lib/moneybird/service/ledger_account.rb +22 -0
- data/lib/moneybird/service/payment.rb +21 -0
- data/lib/moneybird/service/product.rb +22 -0
- data/lib/moneybird/service/recurring_sales_invoice.rb +23 -0
- data/lib/moneybird/service/sales_invoice.rb +26 -0
- data/lib/moneybird/service/tax_rate.rb +19 -0
- data/lib/moneybird/service/webhook.rb +21 -0
- data/lib/moneybird/service/workflow.rb +19 -0
- data/lib/moneybird/token.rb +20 -0
- data/lib/moneybird/traits/administration_service.rb +16 -0
- data/lib/moneybird/traits/delete.rb +12 -0
- data/lib/moneybird/traits/download_pdf.rb +11 -0
- data/lib/moneybird/traits/find.rb +11 -0
- data/lib/moneybird/traits/find_all.rb +51 -0
- data/lib/moneybird/traits/mark_as_uncollectible.rb +17 -0
- data/lib/moneybird/traits/save.rb +26 -0
- data/lib/moneybird/traits/send_invoice.rb +17 -0
- data/lib/moneybird/traits/service.rb +15 -0
- data/lib/moneybird/traits/synchronization.rb +13 -0
- data/lib/moneybird/version.rb +5 -0
- data/lib/moneybird/webhook.rb +31 -0
- data/lib/moneybird.rb +115 -0
- data/moneybird.gemspec +37 -0
- metadata +235 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class Contact
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
address1
|
|
10
|
+
address2
|
|
11
|
+
administration_id
|
|
12
|
+
archived
|
|
13
|
+
attention
|
|
14
|
+
bank_account
|
|
15
|
+
chamber_of_commerce
|
|
16
|
+
city
|
|
17
|
+
company_name
|
|
18
|
+
contact_people
|
|
19
|
+
country
|
|
20
|
+
created_at
|
|
21
|
+
credit_card_number
|
|
22
|
+
credit_card_reference
|
|
23
|
+
credit_card_type
|
|
24
|
+
customer_id
|
|
25
|
+
delivery_method
|
|
26
|
+
email
|
|
27
|
+
email_ubl
|
|
28
|
+
estimate_workflow_id
|
|
29
|
+
firstname
|
|
30
|
+
id
|
|
31
|
+
invoice_workflow_id
|
|
32
|
+
lastname
|
|
33
|
+
moneybird_payments_mandate
|
|
34
|
+
phone
|
|
35
|
+
sales_invoices_url
|
|
36
|
+
send_estimates_to_attention
|
|
37
|
+
send_estimates_to_email
|
|
38
|
+
send_invoices_to_attention
|
|
39
|
+
send_invoices_to_email
|
|
40
|
+
send_method
|
|
41
|
+
sepa_active
|
|
42
|
+
sepa_bic
|
|
43
|
+
sepa_iban
|
|
44
|
+
sepa_iban_account_name
|
|
45
|
+
sepa_mandate_date
|
|
46
|
+
sepa_mandate_id
|
|
47
|
+
sepa_sequence_type
|
|
48
|
+
si_identifier
|
|
49
|
+
si_identifier_type
|
|
50
|
+
tax_number
|
|
51
|
+
tax_number_valid
|
|
52
|
+
tax_number_validated_at
|
|
53
|
+
updated_at
|
|
54
|
+
version
|
|
55
|
+
zipcode
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@attributes += %i(custom_fields events notes)
|
|
59
|
+
attr_reader :custom_fields, :events, :notes
|
|
60
|
+
|
|
61
|
+
def notes=(notes)
|
|
62
|
+
@notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def events=(events)
|
|
66
|
+
@events = events.map{ |event| Moneybird::Resource::Generic::Event.build(event) }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def custom_fields=(custom_fields)
|
|
70
|
+
@custom_fields = custom_fields.map { |custom_field| Moneybird::Resource::CustomField.build(custom_field) }
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class CustomField
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
administration_id
|
|
10
|
+
created_at
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
source
|
|
14
|
+
updated_at
|
|
15
|
+
value
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class DocumentStyle
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
name
|
|
12
|
+
identity_id
|
|
13
|
+
default
|
|
14
|
+
logo_hash
|
|
15
|
+
logo_container_full_width
|
|
16
|
+
logo_display_width
|
|
17
|
+
logo_position
|
|
18
|
+
background_hash
|
|
19
|
+
paper_size
|
|
20
|
+
address_position
|
|
21
|
+
font_size
|
|
22
|
+
font_family
|
|
23
|
+
print_on_stationery
|
|
24
|
+
custom_css
|
|
25
|
+
invoice_sender_address
|
|
26
|
+
invoice_metadata_left
|
|
27
|
+
invoice_metadata_right
|
|
28
|
+
estimate_sender_address
|
|
29
|
+
estimate_metadata_left
|
|
30
|
+
estimate_metadata_right
|
|
31
|
+
created_at
|
|
32
|
+
updated_at
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Documents
|
|
4
|
+
class GeneralDocument
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
contact
|
|
12
|
+
contact_id
|
|
13
|
+
reference
|
|
14
|
+
date
|
|
15
|
+
due_date
|
|
16
|
+
entry_number
|
|
17
|
+
state
|
|
18
|
+
exchange_rate
|
|
19
|
+
created_at
|
|
20
|
+
updated_at
|
|
21
|
+
version
|
|
22
|
+
notes
|
|
23
|
+
attachments
|
|
24
|
+
events
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Documents
|
|
4
|
+
class GeneralJournalDocument
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
contact
|
|
12
|
+
contact_id
|
|
13
|
+
reference
|
|
14
|
+
date
|
|
15
|
+
due_date
|
|
16
|
+
entry_number
|
|
17
|
+
state
|
|
18
|
+
exchange_rate
|
|
19
|
+
created_at
|
|
20
|
+
updated_at
|
|
21
|
+
version
|
|
22
|
+
notes
|
|
23
|
+
attachments
|
|
24
|
+
events
|
|
25
|
+
general_journal_document_entries
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Documents
|
|
4
|
+
class PurchaseInvoice
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
administration_id
|
|
10
|
+
attachments
|
|
11
|
+
contact_id
|
|
12
|
+
created_at
|
|
13
|
+
currency
|
|
14
|
+
date
|
|
15
|
+
due_date
|
|
16
|
+
entry_number
|
|
17
|
+
exchange_rate
|
|
18
|
+
id
|
|
19
|
+
origin
|
|
20
|
+
paid_at
|
|
21
|
+
prices_are_incl_tax
|
|
22
|
+
reference
|
|
23
|
+
revenue_invoice
|
|
24
|
+
state
|
|
25
|
+
tax_number
|
|
26
|
+
total_price_excl_tax
|
|
27
|
+
total_price_excl_tax_base
|
|
28
|
+
total_price_incl_tax
|
|
29
|
+
total_price_incl_tax_base
|
|
30
|
+
updated_at
|
|
31
|
+
version
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
@attributes += %i(contact details events notes payments)
|
|
35
|
+
attr_reader :contact, :details, :events, :notes, :payments
|
|
36
|
+
|
|
37
|
+
def notes=(notes)
|
|
38
|
+
@notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def contact=(attributes)
|
|
42
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def details=(line_items)
|
|
46
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def events=(events)
|
|
50
|
+
@events = events.map{ |event| Moneybird::Resource::Generic::Event.build(event) }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def payments=(payments)
|
|
54
|
+
@payments = payments.map{ |payment| Moneybird::Resource::Invoice::Payment.build(payment) }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Documents
|
|
4
|
+
class Receipt
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
administration_id
|
|
10
|
+
attachments
|
|
11
|
+
contact_id
|
|
12
|
+
created_at
|
|
13
|
+
currency
|
|
14
|
+
date
|
|
15
|
+
due_date
|
|
16
|
+
entry_number
|
|
17
|
+
exchange_rate
|
|
18
|
+
id
|
|
19
|
+
origin
|
|
20
|
+
paid_at
|
|
21
|
+
prices_are_incl_tax
|
|
22
|
+
reference
|
|
23
|
+
revenue_invoice
|
|
24
|
+
state
|
|
25
|
+
tax_number
|
|
26
|
+
total_price_excl_tax
|
|
27
|
+
total_price_excl_tax_base
|
|
28
|
+
total_price_incl_tax
|
|
29
|
+
total_price_incl_tax_base
|
|
30
|
+
updated_at
|
|
31
|
+
version
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
@attributes += %i(contact details events notes payments)
|
|
35
|
+
attr_reader :contact, :details, :events, :notes, :payments
|
|
36
|
+
|
|
37
|
+
def notes=(notes)
|
|
38
|
+
@notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def contact=(attributes)
|
|
42
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def details=(line_items)
|
|
46
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def events=(events)
|
|
50
|
+
@events = events.map{ |event| Moneybird::Resource::Generic::Event.build(event) }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def payments=(payments)
|
|
54
|
+
@payments = payments.map{ |payment| Moneybird::Resource::Invoice::Payment.build(payment) }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Documents
|
|
4
|
+
class TypelessDocument
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
contact
|
|
12
|
+
contact_id
|
|
13
|
+
reference
|
|
14
|
+
date
|
|
15
|
+
due_date
|
|
16
|
+
entry_number
|
|
17
|
+
state
|
|
18
|
+
exchange_rate
|
|
19
|
+
created_at
|
|
20
|
+
updated_at
|
|
21
|
+
version
|
|
22
|
+
notes
|
|
23
|
+
attachments
|
|
24
|
+
events
|
|
25
|
+
origin
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class Estimate
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
accepted_at
|
|
10
|
+
administration_id
|
|
11
|
+
archived_at
|
|
12
|
+
attachments
|
|
13
|
+
contact_id
|
|
14
|
+
created_at
|
|
15
|
+
currency
|
|
16
|
+
custom_fields
|
|
17
|
+
discount
|
|
18
|
+
document_style_id
|
|
19
|
+
draft_id
|
|
20
|
+
due_date
|
|
21
|
+
estimate_date
|
|
22
|
+
estimate_id
|
|
23
|
+
events
|
|
24
|
+
exchange_rate
|
|
25
|
+
id
|
|
26
|
+
identity_id
|
|
27
|
+
language
|
|
28
|
+
original_estimate_id
|
|
29
|
+
post_text
|
|
30
|
+
pre_text
|
|
31
|
+
reference
|
|
32
|
+
rejected_at
|
|
33
|
+
sent_at
|
|
34
|
+
show_tax
|
|
35
|
+
sign_online
|
|
36
|
+
state
|
|
37
|
+
tax_totals
|
|
38
|
+
total_discount
|
|
39
|
+
total_price_excl_tax
|
|
40
|
+
total_price_excl_tax_base
|
|
41
|
+
total_price_incl_tax
|
|
42
|
+
total_price_incl_tax_base
|
|
43
|
+
updated_at
|
|
44
|
+
url
|
|
45
|
+
version
|
|
46
|
+
workflow_id
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
@attributes += %i(contact details notes)
|
|
50
|
+
attr_reader :contact, :details, :notes
|
|
51
|
+
|
|
52
|
+
def notes=(notes)
|
|
53
|
+
@notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def contact=(attributes)
|
|
57
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def details=(line_items)
|
|
61
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class ExternalSalesInvoice
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
contact_id
|
|
12
|
+
date
|
|
13
|
+
state
|
|
14
|
+
due_date
|
|
15
|
+
reference
|
|
16
|
+
entry_number
|
|
17
|
+
origin
|
|
18
|
+
source
|
|
19
|
+
source_url
|
|
20
|
+
currency
|
|
21
|
+
paid_at
|
|
22
|
+
created_at
|
|
23
|
+
updated_at
|
|
24
|
+
version
|
|
25
|
+
attachments
|
|
26
|
+
tax_totals
|
|
27
|
+
total_paid
|
|
28
|
+
total_unpaid
|
|
29
|
+
total_unpaid_base
|
|
30
|
+
prices_are_incl_tax
|
|
31
|
+
total_price_excl_tax
|
|
32
|
+
total_price_excl_tax_base
|
|
33
|
+
total_price_incl_tax
|
|
34
|
+
total_price_incl_tax_base
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
@attributes += %i(contact details events notes payments)
|
|
38
|
+
attr_reader :contact, :details, :events, :notes, :payments
|
|
39
|
+
|
|
40
|
+
def notes=(notes)
|
|
41
|
+
@notes = notes.map{ |note| Moneybird::Resource::Generic::Note.build(note) }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def contact=(attributes)
|
|
45
|
+
@contact = Moneybird::Resource::Contact.build(attributes)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def payments=(payments)
|
|
49
|
+
payment_data = payments.map{ |payment| Moneybird::Resource::Invoice::Payment.build(payment) }
|
|
50
|
+
@payments = Moneybird::Service::Payment.new(client, administration_id, preloaded_data: payment_data, invoice_id: id)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def details=(line_items)
|
|
54
|
+
@details = line_items.map{ |line_item| Moneybird::Resource::Invoice::Details.build(line_item) }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def events=(events)
|
|
58
|
+
@events = events.map{ |event| Moneybird::Resource::Generic::Event.build(event) }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class FinancialAccount
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
type
|
|
12
|
+
name
|
|
13
|
+
identifier
|
|
14
|
+
currency
|
|
15
|
+
provider
|
|
16
|
+
active
|
|
17
|
+
created_at
|
|
18
|
+
updated_at
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class FinancialMutation
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
account_servicer_transaction_id
|
|
10
|
+
administration_id
|
|
11
|
+
amount
|
|
12
|
+
amount_open
|
|
13
|
+
batch_reference
|
|
14
|
+
code
|
|
15
|
+
contra_account_name
|
|
16
|
+
contra_account_number
|
|
17
|
+
created_at
|
|
18
|
+
currency
|
|
19
|
+
date
|
|
20
|
+
financial_account_id
|
|
21
|
+
financial_statement_id
|
|
22
|
+
id
|
|
23
|
+
ledger_account_bookings
|
|
24
|
+
message
|
|
25
|
+
original_amount
|
|
26
|
+
payments
|
|
27
|
+
processed_at
|
|
28
|
+
sepa_fields
|
|
29
|
+
state
|
|
30
|
+
updated_at
|
|
31
|
+
version
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def link_booking(booking)
|
|
36
|
+
financial_mutation_service = Moneybird::Service::FinancialMutation.new(client, administration_id)
|
|
37
|
+
financial_mutation_service.link_booking(self, booking)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Generic
|
|
4
|
+
class Event
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
user_id
|
|
10
|
+
administration_id
|
|
11
|
+
action
|
|
12
|
+
link_entity_id
|
|
13
|
+
link_entity_type
|
|
14
|
+
data
|
|
15
|
+
created_at
|
|
16
|
+
updated_at
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Generic
|
|
4
|
+
class Note
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
entity_id
|
|
12
|
+
entity_type
|
|
13
|
+
user_id
|
|
14
|
+
assignee_id
|
|
15
|
+
todo
|
|
16
|
+
note
|
|
17
|
+
completed_at
|
|
18
|
+
completed_by_id
|
|
19
|
+
todo_type
|
|
20
|
+
data
|
|
21
|
+
created_at
|
|
22
|
+
updated_at
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class Identity
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
company_name
|
|
12
|
+
city
|
|
13
|
+
country
|
|
14
|
+
zipcode
|
|
15
|
+
address1
|
|
16
|
+
address2
|
|
17
|
+
email
|
|
18
|
+
phone
|
|
19
|
+
bank_account_name
|
|
20
|
+
bank_account_number
|
|
21
|
+
bank_account_bic
|
|
22
|
+
custom_fields
|
|
23
|
+
created_at
|
|
24
|
+
updated_at
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def custom_fields=(custom_fields)
|
|
29
|
+
@custom_fields = custom_fields.map { |custom_field| Moneybird::Resource::CustomField.build(custom_field) }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Invoice
|
|
4
|
+
class Details
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
administration_id
|
|
10
|
+
amount
|
|
11
|
+
amount_decimal
|
|
12
|
+
created_at
|
|
13
|
+
description
|
|
14
|
+
id
|
|
15
|
+
ledger_account_id
|
|
16
|
+
mandatory_tax_text
|
|
17
|
+
period
|
|
18
|
+
price
|
|
19
|
+
product_id
|
|
20
|
+
project_id
|
|
21
|
+
row_order
|
|
22
|
+
tax_rate_id
|
|
23
|
+
tax_report_reference
|
|
24
|
+
total_price_excl_tax_with_discount
|
|
25
|
+
total_price_excl_tax_with_discount_base
|
|
26
|
+
updated_at
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource::Invoice
|
|
4
|
+
class Payment
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
administration_id
|
|
10
|
+
created_at
|
|
11
|
+
credit_invoice_id
|
|
12
|
+
financial_account_id
|
|
13
|
+
financial_mutation_id
|
|
14
|
+
id
|
|
15
|
+
invoice_id
|
|
16
|
+
invoice_type
|
|
17
|
+
payment_date
|
|
18
|
+
payment_transaction_id
|
|
19
|
+
price
|
|
20
|
+
price_base
|
|
21
|
+
transaction_identifier
|
|
22
|
+
updated_at
|
|
23
|
+
user_id
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class LedgerAccount
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
administration_id
|
|
11
|
+
name
|
|
12
|
+
account_type
|
|
13
|
+
account_id
|
|
14
|
+
parent_id
|
|
15
|
+
created_at
|
|
16
|
+
updated_at
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Moneybird::Resource
|
|
4
|
+
class Product
|
|
5
|
+
include Moneybird::Resource
|
|
6
|
+
extend Moneybird::Resource::ClassMethods
|
|
7
|
+
|
|
8
|
+
has_attributes %i(
|
|
9
|
+
id
|
|
10
|
+
description
|
|
11
|
+
price
|
|
12
|
+
tax_rate_id
|
|
13
|
+
ledger_account_id
|
|
14
|
+
created_at
|
|
15
|
+
updated_at
|
|
16
|
+
administration_id
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|