tripletexer 0.1.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/LICENSE +26 -0
- data/README.md +35 -0
- data/lib/tripletexer.rb +136 -0
- data/lib/tripletexer/connection.rb +49 -0
- data/lib/tripletexer/endpoints.rb +3 -0
- data/lib/tripletexer/endpoints/abstract_endpoint.rb +106 -0
- data/lib/tripletexer/endpoints/activity.rb +22 -0
- data/lib/tripletexer/endpoints/address.rb +22 -0
- data/lib/tripletexer/endpoints/company.rb +17 -0
- data/lib/tripletexer/endpoints/contact.rb +22 -0
- data/lib/tripletexer/endpoints/country.rb +17 -0
- data/lib/tripletexer/endpoints/currency.rb +17 -0
- data/lib/tripletexer/endpoints/customer.rb +31 -0
- data/lib/tripletexer/endpoints/customer/category.rb +27 -0
- data/lib/tripletexer/endpoints/department.rb +17 -0
- data/lib/tripletexer/endpoints/employee.rb +20 -0
- data/lib/tripletexer/endpoints/employee/entitlement.rb +15 -0
- data/lib/tripletexer/endpoints/inventory.rb +15 -0
- data/lib/tripletexer/endpoints/invoice.rb +44 -0
- data/lib/tripletexer/endpoints/invoice/payment_type.rb +16 -0
- data/lib/tripletexer/endpoints/ledger.rb +49 -0
- data/lib/tripletexer/endpoints/ledger/account.rb +17 -0
- data/lib/tripletexer/endpoints/ledger/accounting_period.rb +17 -0
- data/lib/tripletexer/endpoints/ledger/annual_account.rb +17 -0
- data/lib/tripletexer/endpoints/ledger/close_group.rb +19 -0
- data/lib/tripletexer/endpoints/ledger/posting.rb +21 -0
- data/lib/tripletexer/endpoints/ledger/vat_type.rb +17 -0
- data/lib/tripletexer/endpoints/ledger/voucher.rb +40 -0
- data/lib/tripletexer/endpoints/ledger/voucher_type.rb +17 -0
- data/lib/tripletexer/endpoints/order.rb +43 -0
- data/lib/tripletexer/endpoints/order/orderline.rb +21 -0
- data/lib/tripletexer/endpoints/product.rb +17 -0
- data/lib/tripletexer/endpoints/project.rb +26 -0
- data/lib/tripletexer/endpoints/project/category.rb +27 -0
- data/lib/tripletexer/endpoints/supplier.rb +27 -0
- data/lib/tripletexer/endpoints/timesheet.rb +13 -0
- data/lib/tripletexer/endpoints/timesheet/entry.rb +64 -0
- data/lib/tripletexer/endpoints/timesheet/time_clock.rb +39 -0
- data/lib/tripletexer/endpoints/token.rb +13 -0
- data/lib/tripletexer/endpoints/token/consumer.rb +13 -0
- data/lib/tripletexer/endpoints/token/session.rb +32 -0
- data/lib/tripletexer/errors.rb +11 -0
- data/lib/tripletexer/format_helpers.rb +12 -0
- data/lib/tripletexer/version.rb +6 -0
- metadata +228 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Country < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/country/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/country', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/country/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/country/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Currency < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/currency/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/currency', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/currency/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/currency/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Customer < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/customer/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/customer', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/customer/post
|
12
|
+
def create(body)
|
13
|
+
create_entity('/v2/customer', body)
|
14
|
+
end
|
15
|
+
|
16
|
+
# https://tripletex.no/v2-docs/#!/customer/get
|
17
|
+
def find(id, params = {})
|
18
|
+
find_entity("/v2/customer/#{id}", params)
|
19
|
+
end
|
20
|
+
|
21
|
+
# https://tripletex.no/v2-docs/#!/customer/put
|
22
|
+
def update(id, body)
|
23
|
+
update_entity("/v2/customer/#{id}", body)
|
24
|
+
end
|
25
|
+
|
26
|
+
def category
|
27
|
+
Tripletexer::Endpoints::Customer::Category.new(connection)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Customer::Category < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/customer47category/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/customer/category', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/customer47category/post
|
12
|
+
def create(body)
|
13
|
+
create_entity('/v2/customer/category', body)
|
14
|
+
end
|
15
|
+
|
16
|
+
# https://tripletex.no/v2-docs/#!/customer47category/get
|
17
|
+
def find(id, params = {})
|
18
|
+
find_entity("/v2/customer/category/#{id}", params)
|
19
|
+
end
|
20
|
+
|
21
|
+
# https://tripletex.no/v2-docs/#!/customer47category/put
|
22
|
+
def update(id, body)
|
23
|
+
update_entity("/v2/customer/category/#{id}", body)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Department < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/department/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/department', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/department/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/department/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Employee < AbstractEndpoint
|
5
|
+
# https://tripletex.no/v2-docs/#!/employee/search
|
6
|
+
def search(params = {})
|
7
|
+
find_entities('/v2/employee', params)
|
8
|
+
end
|
9
|
+
|
10
|
+
# https://tripletex.no/v2-docs/#!/employee/get
|
11
|
+
def find(id, params = {})
|
12
|
+
find_entity("/v2/employee/#{id}", params)
|
13
|
+
end
|
14
|
+
|
15
|
+
def entitlement
|
16
|
+
Tripletexer::Endpoints::Employee::Entitlement.new(connection)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Employee::Entitlement < AbstractEndpoint
|
5
|
+
# https://tripletex.no/v2-docs/#!/employee47entitlement/search
|
6
|
+
def search(params = {})
|
7
|
+
find_entities('/v2/employee/entitlement', params)
|
8
|
+
end
|
9
|
+
|
10
|
+
# https://tripletex.no/v2-docs/#!/employee47entitlement/get
|
11
|
+
def find(id, params = {})
|
12
|
+
find_entity("/v2/employee/entitlement/#{id}", params)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Inventory < AbstractEndpoint
|
5
|
+
# https://tripletex.no/v2-docs/#!/inventory/search
|
6
|
+
def search(params = {})
|
7
|
+
find_entities('/v2/inventory', params)
|
8
|
+
end
|
9
|
+
|
10
|
+
# https://tripletex.no/v2-docs/#!/inventory/get
|
11
|
+
def find(id, params = {})
|
12
|
+
find_entity("/v2/inventory/#{id}", params)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Invoice < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/invoice/search
|
7
|
+
def search(date_from, date_to, params = {})
|
8
|
+
final_params = params.merge(
|
9
|
+
'invoiceDateFrom' => format_date(date_from),
|
10
|
+
'invoiceDateTo' => format_date(date_to)
|
11
|
+
)
|
12
|
+
find_entities('/v2/invoice', final_params)
|
13
|
+
end
|
14
|
+
|
15
|
+
# https://tripletex.no/v2-docs/#!/invoice/post
|
16
|
+
def create(body)
|
17
|
+
create_entity('/v2/invoice', body)
|
18
|
+
end
|
19
|
+
|
20
|
+
# https://tripletex.no/v2-docs/#!/invoice/get
|
21
|
+
def find(id, params = {})
|
22
|
+
find_entity("/v2/invoice/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# https://tripletex.no/v2-docs/#!/invoice/downloadPdf
|
26
|
+
def download_pdf(id)
|
27
|
+
get("/v2/invoice/#{id}/pdf")
|
28
|
+
end
|
29
|
+
|
30
|
+
# https://tripletex.no/v2-docs/#!/invoice/payment
|
31
|
+
def update_with_payment(id, payment_date, payment_type_id, paid_amount)
|
32
|
+
final_params = {
|
33
|
+
'paymentDate' => payment_date,
|
34
|
+
'paymentTypeId' => payment_type_id,
|
35
|
+
'paidAmount' => paid_amount
|
36
|
+
}
|
37
|
+
put("/v2/invoice/#{id}/:payment", final_params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def payment_type
|
41
|
+
Tripletexer::Endpoints::Invoice::PaymentType.new(connection)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Invoice::PaymentType < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/invoice47paymentType/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/invoice/paymentType', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/invoice47paymentType/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/invoice/paymentType/#{id}", params)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger < AbstractEndpoint
|
5
|
+
DEFAULT_FIELDS = '*,account(id,number,name,description),postings(*)'
|
6
|
+
|
7
|
+
# https://tripletex.no/v2-docs/#!/ledger/search
|
8
|
+
def search(date_from, date_to, params = {})
|
9
|
+
final_params = params.merge(
|
10
|
+
'dateFrom' => format_date(date_from),
|
11
|
+
'dateTo' => format_date(date_to)
|
12
|
+
)
|
13
|
+
final_params['fields'] = DEFAULT_FIELDS unless final_params.key?('fields')
|
14
|
+
find_entities('/v2/ledger', final_params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def account
|
18
|
+
Tripletexer::Endpoints::Ledger::Account.new(connection)
|
19
|
+
end
|
20
|
+
|
21
|
+
def accounting_period
|
22
|
+
Tripletexer::Endpoints::Ledger::AccountingPeriod.new(connection)
|
23
|
+
end
|
24
|
+
|
25
|
+
def annual_account
|
26
|
+
Tripletexer::Endpoints::Ledger::AnnualAccount.new(connection)
|
27
|
+
end
|
28
|
+
|
29
|
+
def close_group
|
30
|
+
Tripletexer::Endpoints::Ledger::CloseGroup.new(connection)
|
31
|
+
end
|
32
|
+
|
33
|
+
def posting
|
34
|
+
Tripletexer::Api::Ledger::Posting.new(connection)
|
35
|
+
end
|
36
|
+
|
37
|
+
def vat_type
|
38
|
+
Tripletexer::Api::Ledger::VatType.new(connection)
|
39
|
+
end
|
40
|
+
|
41
|
+
def voucher
|
42
|
+
Tripletexer::Api::Ledger::Voucher.new(connection)
|
43
|
+
end
|
44
|
+
|
45
|
+
def type
|
46
|
+
Tripletexer::Api::Ledger::Type.new(connection)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::Account < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47account/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/ledger/account', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/ledger47account/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/ledger/account/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::AccountingPeriod < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47accountingPeriod/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/ledger/accountingPeriod', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/ledger47accountingPeriod/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/ledger/accountingPeriod/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::AnnualAccount < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47annualAccount/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/ledger/annualAccount', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/ledger47annualAccount/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/ledger/annualAccount/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::CloseGroup < AbstractEndpoint
|
5
|
+
# https://tripletex.no/v2-docs/#!/ledger47closeGroup/search
|
6
|
+
def search(date_from, date_to, params = {})
|
7
|
+
final_params = params.merge(
|
8
|
+
'dateFrom' => format_date(date_from),
|
9
|
+
'dateTo' => format_date(date_to)
|
10
|
+
)
|
11
|
+
find_entities('/v2/ledger/closeGroup', final_params)
|
12
|
+
end
|
13
|
+
|
14
|
+
# https://tripletex.no/v2-docs/#!/ledger47closeGroup/get
|
15
|
+
def find(id, params = {})
|
16
|
+
find_entity("/v2/ledger/closeGroup/#{id}", params)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::Posting < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47posting/search
|
7
|
+
def search(date_from, date_to, params = {})
|
8
|
+
final_params = params.merge(
|
9
|
+
'dateFrom' => format_date(date_from),
|
10
|
+
'dateTo' => format_date(date_to)
|
11
|
+
)
|
12
|
+
find_entities('/v2/ledger/posting', final_params)
|
13
|
+
end
|
14
|
+
|
15
|
+
# https://tripletex.no/v2-docs/#!/ledger47posting/get
|
16
|
+
def find(id, params = {})
|
17
|
+
find_entity("/v2/ledger/posting/#{id}", params)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::VatType < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47vatType/search
|
7
|
+
def search(params = {})
|
8
|
+
find_entities('/v2/ledger/vatType', params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# https://tripletex.no/v2-docs/#!/ledger47vatType/get
|
12
|
+
def find(id, params = {})
|
13
|
+
find_entity("/v2/ledger/vatType/#{id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tripletexer::Endpoints
|
4
|
+
class Ledger::Voucher < AbstractEndpoint
|
5
|
+
|
6
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/search
|
7
|
+
def search(date_from, date_to, params = {})
|
8
|
+
final_params = params.merge(
|
9
|
+
'invoiceDateFrom' => format_date(date_from),
|
10
|
+
'invoiceDateTo' => format_date(date_to)
|
11
|
+
)
|
12
|
+
find_entities('/v2/ledger/voucher', final_params)
|
13
|
+
end
|
14
|
+
|
15
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/post
|
16
|
+
def create(send_to_ledger, body)
|
17
|
+
create_entity('/v2/ledger/voucher', body, { 'sendToLedger' => send_to_ledger.to_s })
|
18
|
+
end
|
19
|
+
|
20
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/get
|
21
|
+
def find(id, params = {})
|
22
|
+
find_entity("/v2/ledger/voucher/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/put
|
26
|
+
def update(id, send_to_ledger, body)
|
27
|
+
update_entity("/v2/ledger/voucher/#{id}", body, { 'sendToLedger' => send_to_ledger.to_s })
|
28
|
+
end
|
29
|
+
|
30
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/downloadPdf
|
31
|
+
def download_pdf(id)
|
32
|
+
get("/v2/ledger/voucher/#{id}/pdf")
|
33
|
+
end
|
34
|
+
|
35
|
+
# https://tripletex.no/v2-docs/#!/ledger47voucher/uploadPdf
|
36
|
+
def upload_pdf(_id, _filename, _file)
|
37
|
+
raise NotImplementedError
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|