frilans_finans_api 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +6 -0
  6. data/{README.MD → README.md} +0 -0
  7. data/Rakefile +8 -0
  8. data/fixtures/companies_fixture.json +55 -0
  9. data/fixtures/company_fixture.json +18 -0
  10. data/fixtures/company_post_body_fixture.json +13 -0
  11. data/fixtures/company_post_fixture.json +13 -0
  12. data/fixtures/currencies_fixture.json +148 -0
  13. data/fixtures/invoice_fixture.json +11 -0
  14. data/fixtures/invoice_post_body_fixture.json +26 -0
  15. data/fixtures/invoice_post_fixture.json +11 -0
  16. data/fixtures/invoices_fixture.json +111 -0
  17. data/fixtures/profession_fixture.json +14 -0
  18. data/fixtures/professions_fixture.json +150 -0
  19. data/fixtures/salaries_fixture.json +45 -0
  20. data/fixtures/tax_fixture.json +13 -0
  21. data/fixtures/taxes_fixture.json +59 -0
  22. data/fixtures/user_fixture.json +30 -0
  23. data/fixtures/user_post_body_fixture.json +9 -0
  24. data/fixtures/user_post_fixture.json +30 -0
  25. data/fixtures/users_fixture.json +56 -0
  26. data/frilans_finans_api.gemspec +32 -0
  27. data/lib/frilans_finans_api/client/client.rb +88 -0
  28. data/lib/frilans_finans_api/client/fixture_client.rb +83 -0
  29. data/lib/frilans_finans_api/client/nil_client.rb +31 -0
  30. data/lib/frilans_finans_api/client/request.rb +145 -0
  31. data/lib/frilans_finans_api/client/terms.rb +28 -0
  32. data/lib/frilans_finans_api/client/walker.rb +29 -0
  33. data/lib/frilans_finans_api/models/company.rb +10 -0
  34. data/lib/frilans_finans_api/models/currency.rb +12 -0
  35. data/lib/frilans_finans_api/models/employment_certificate.rb +10 -0
  36. data/lib/frilans_finans_api/models/invoice.rb +20 -0
  37. data/lib/frilans_finans_api/models/profession.rb +17 -0
  38. data/lib/frilans_finans_api/models/salary.rb +10 -0
  39. data/lib/frilans_finans_api/models/tax.rb +12 -0
  40. data/lib/frilans_finans_api/models/user.rb +27 -0
  41. data/lib/frilans_finans_api/version.rb +1 -1
  42. data/lib/frilans_finans_api.rb +61 -0
  43. metadata +41 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0012708294cbf004471c28d9c74c12eb34aff89f'
4
- data.tar.gz: fcae44a56ac49405fad283e6ab5a66e5289ef68a
3
+ metadata.gz: 1bb06aed03f8ba4d60de94354967e706abb79a21
4
+ data.tar.gz: 8934abaf4be95a631d2de7241a8b4fadd16d083e
5
5
  SHA512:
6
- metadata.gz: 5290b1c50fc7d003885038c10aef303dc98fcd47c4792009ab2eadb2f3feca18f8883b358be4d57590e71c24569d3fef73071a9f6d42fcbe1d8e271ddf581c62
7
- data.tar.gz: 3f08bab11dab79cf670ef17293262d2117568b94a3b95de3d6651ae0ad43b223216881e8acb428f15d7a7b2aac5574b0389f9e9fd78255fa937748d597d12e50
6
+ metadata.gz: 9f76f0407a115313f3e115f8824462c9ff3e08a929b20ae8d59f9e512c9f1705af8ce8f49040736cfe5c8e7b473f4fa689a44e901a073bdfd87f1e4ab714756e
7
+ data.tar.gz: 02d77597962398f2a649fe2fdfef4ecba9236c615d4c79cd9071260e2323008d44c5cdc9f361e910ae1e35bf8bbf8baa5ac88e913d048c67b6041441e2b3a533
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .DS_STORE
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4.1
4
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in frilans_finans_api.gemspec
6
+ gemspec
File without changes
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,55 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "companies",
5
+ "id": "1",
6
+ "attributes": {
7
+ "name": "ACME AB",
8
+ "co": "123",
9
+ "street": "Plommonvägen 139",
10
+ "zip": "1345",
11
+ "city": "Uppsla",
12
+ "country": "SWEDEN",
13
+ "contact": "John Doe",
14
+ "phone": "13247",
15
+ "email": "john.doe@example.com",
16
+ "user_id": 1,
17
+ "send_to_email": "jane.doe@example.com"
18
+ },
19
+ "links": {
20
+ "self": "https://frilansfinans.se/api/company/1"
21
+ }
22
+ },
23
+ {
24
+ "type": "companies",
25
+ "id": "2",
26
+ "attributes": {
27
+ "name": "Acme 1 AB",
28
+ "co": "",
29
+ "street": "Kungsängsgatan 12",
30
+ "zip": "74330",
31
+ "city": "Uppsala",
32
+ "country": "Sverige",
33
+ "contact": "Jane Doe",
34
+ "phone": "018790900",
35
+ "email": "jane.doe@example.com",
36
+ "user_id": 1,
37
+ "send_to_email": "john.doe@example.com"
38
+ },
39
+ "links": {
40
+ "self": "https://frilansfinans.se/api/company/2"
41
+ }
42
+ }
43
+ ],
44
+ "meta": {
45
+ "pagination": {
46
+ "page": {
47
+ "size": 25,
48
+ "number": 1,
49
+ "items": 25
50
+ },
51
+ "items": 2,
52
+ "pages": 1
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "data": {
3
+ "type": "companies",
4
+ "id": "1",
5
+ "attributes": {
6
+ "name": "Acme",
7
+ "street": "Dag Hammarskjölds väg 13",
8
+ "zip": "75237",
9
+ "city": "UPPSALA",
10
+ "country": "SWEDEN",
11
+ "user_id": 1,
12
+ "send_to_email": null
13
+ },
14
+ "links": {
15
+ "self": "https://frilansfinans.se/api/company/1"
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
3
+ "data": {
4
+ "attributes": {
5
+ "name": "Acme",
6
+ "street": "Dag Hammarskjölds väg 13",
7
+ "zip": "75237",
8
+ "city": "UPPSALA",
9
+ "country": "SWEDEN",
10
+ "user_id": 1
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": {
3
+ "type": "companies",
4
+ "attributes": {
5
+ "name": "Acme",
6
+ "street": "Dag Hammarskjölds väg 13",
7
+ "zip": "75237",
8
+ "city": "UPPSALA",
9
+ "country": "SWEDEN",
10
+ "user_id": 1
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "currencies",
5
+ "id": "1",
6
+ "attributes": {
7
+ "active": 1,
8
+ "standard": 1,
9
+ "name": "SEK",
10
+ "code": "SEK",
11
+ "exchange_rate": 1,
12
+ "updated_at": {
13
+ "date": "2008-02-20 13:44:00.000000",
14
+ "timezone_type": 3,
15
+ "timezone": "UTC"
16
+ }
17
+ },
18
+ "links": {
19
+ "self": "https://frilansfinans.se/api/currency/1"
20
+ }
21
+ },
22
+ {
23
+ "type": "currencies",
24
+ "id": "2",
25
+ "attributes": {
26
+ "active": 1,
27
+ "standard": 0,
28
+ "name": "EUR",
29
+ "code": "EUR",
30
+ "exchange_rate": 9.2904,
31
+ "updated_at": {
32
+ "date": "2016-04-08 11:00:02.000000",
33
+ "timezone_type": 3,
34
+ "timezone": "UTC"
35
+ }
36
+ },
37
+ "links": {
38
+ "self": "https://frilansfinans.se/api/currency/2"
39
+ }
40
+ },
41
+ {
42
+ "type": "currencies",
43
+ "id": "3",
44
+ "attributes": {
45
+ "active": 1,
46
+ "standard": 0,
47
+ "name": "USD",
48
+ "code": "USD",
49
+ "exchange_rate": 8.1591,
50
+ "updated_at": {
51
+ "date": "2016-04-08 11:00:02.000000",
52
+ "timezone_type": 3,
53
+ "timezone": "UTC"
54
+ }
55
+ },
56
+ "links": {
57
+ "self": "https://frilansfinans.se/api/currency/3"
58
+ }
59
+ },
60
+ {
61
+ "type": "currencies",
62
+ "id": "4",
63
+ "attributes": {
64
+ "active": 1,
65
+ "standard": 0,
66
+ "name": "CHF",
67
+ "code": "CHF",
68
+ "exchange_rate": 8.5322,
69
+ "updated_at": {
70
+ "date": "2016-04-08 11:00:02.000000",
71
+ "timezone_type": 3,
72
+ "timezone": "UTC"
73
+ }
74
+ },
75
+ "links": {
76
+ "self": "https://frilansfinans.se/api/currency/4"
77
+ }
78
+ },
79
+ {
80
+ "type": "currencies",
81
+ "id": "5",
82
+ "attributes": {
83
+ "active": 1,
84
+ "standard": 0,
85
+ "name": "DKK",
86
+ "code": "DKK",
87
+ "exchange_rate": 1.2484,
88
+ "updated_at": {
89
+ "date": "2016-04-08 11:00:02.000000",
90
+ "timezone_type": 3,
91
+ "timezone": "UTC"
92
+ }
93
+ },
94
+ "links": {
95
+ "self": "https://frilansfinans.se/api/currency/5"
96
+ }
97
+ },
98
+ {
99
+ "type": "currencies",
100
+ "id": "6",
101
+ "attributes": {
102
+ "active": 1,
103
+ "standard": 0,
104
+ "name": "GBP",
105
+ "code": "GBP",
106
+ "exchange_rate": 11.5093,
107
+ "updated_at": {
108
+ "date": "2016-04-08 11:00:02.000000",
109
+ "timezone_type": 3,
110
+ "timezone": "UTC"
111
+ }
112
+ },
113
+ "links": {
114
+ "self": "https://frilansfinans.se/api/currency/6"
115
+ }
116
+ },
117
+ {
118
+ "type": "currencies",
119
+ "id": "7",
120
+ "attributes": {
121
+ "active": 1,
122
+ "standard": 0,
123
+ "name": "NOK",
124
+ "code": "NOK",
125
+ "exchange_rate": 0.984539,
126
+ "updated_at": {
127
+ "date": "2016-04-08 11:00:02.000000",
128
+ "timezone_type": 3,
129
+ "timezone": "UTC"
130
+ }
131
+ },
132
+ "links": {
133
+ "self": "https://frilansfinans.se/api/currency/7"
134
+ }
135
+ }
136
+ ],
137
+ "meta": {
138
+ "pagination": {
139
+ "page": {
140
+ "size": 25,
141
+ "number": 1,
142
+ "items": 25
143
+ },
144
+ "items": 7,
145
+ "pages": 1
146
+ }
147
+ }
148
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "data": {
3
+ "type": "invoices",
4
+ "id": "1",
5
+ "attributes": {
6
+ },
7
+ "links": {
8
+ "self": "http://frilansfinans.se/api/invoice/1"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "data": {
3
+ "attributes": {
4
+ "specification": "Specification text",
5
+ "amount": 100,
6
+ "tax_id": 1,
7
+ "company_id": 1,
8
+ "currency_id": 1,
9
+ "user_id": 1,
10
+ "invoiceuser": [{
11
+ "user_id": 1,
12
+ "taxkey_id": 1337,
13
+ "allowance": 0,
14
+ "travel": 0,
15
+ "total": 100,
16
+ "save_vacation_pay": 0,
17
+ "save_itp": 0,
18
+ "express_payment": 0
19
+ }],
20
+ "invoicedate": [{
21
+ "date": "2016-04-05 16:24:00",
22
+ "hours": 1
23
+ }]
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "data": {
3
+ "type": "invoices",
4
+ "id": "1",
5
+ "attributes": {
6
+ },
7
+ "links": {
8
+ "self": "http://frilansfinans.se/api/invoice/1"
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "invoices",
5
+ "id": "1",
6
+ "attributes": {
7
+ "specification": "One invoice to rule them all",
8
+ "pre_report": 0,
9
+ "ownership": 0,
10
+ "lastChangedBy": 0,
11
+ "invoice_number": null,
12
+ "user_id": 1,
13
+ "tax_id": 1,
14
+ "amount": 2000,
15
+ "gross": 1000,
16
+ "net": 1000,
17
+ "allowance": 0,
18
+ "travel": 0,
19
+ "expense": 0,
20
+ "company_id": 1,
21
+ "company_name": "Acme AB",
22
+ "company_co": "",
23
+ "company_street": "Smetvägen",
24
+ "company_zip": "12345",
25
+ "company_city": "Uppsala",
26
+ "company_country": "SWEDEN",
27
+ "company_vat": "",
28
+ "company_contact": "Jane Doe",
29
+ "company_email": "jane.doe@example.com",
30
+ "currency_id": 1,
31
+ "currency_exchange_rate": 1,
32
+ "currency_amount": 2000,
33
+ "payment_status": 1,
34
+ "approval_status": 1,
35
+ "status": 1,
36
+ "full_payment_date_time": "0000-00-00 00:00:00",
37
+ "sent": "0000-00-00 00:00:00",
38
+ "created_at": "2016-04-05 16:24:00",
39
+ "note": null,
40
+ "supplier_ledger_date_time": "0000-00-00 00:00:00",
41
+ "extra_security": 0,
42
+ "send_to_email": "john.doe@example.com",
43
+ "saved_invoice_created_at": "0000-00-00 00:00:00",
44
+ "api_consumer_id": 0,
45
+ "special_tax_id": 0
46
+ },
47
+ "links": {
48
+ "self": "https://frilansfinans.se/api/invoice/1"
49
+ }
50
+ },
51
+ {
52
+ "type": "invoices",
53
+ "id": "2",
54
+ "attributes": {
55
+ "specification": "A pre-reported invoice to rule them all",
56
+ "pre_report": 1,
57
+ "ownership": 0,
58
+ "lastChangedBy": 0,
59
+ "invoice_number": null,
60
+ "user_id": 1,
61
+ "tax_id": 1,
62
+ "amount": 2000,
63
+ "gross": 1000,
64
+ "net": 1000,
65
+ "allowance": 0,
66
+ "travel": 0,
67
+ "expense": 0,
68
+ "company_id": 1,
69
+ "company_name": "Acme AB",
70
+ "company_co": "",
71
+ "company_street": "Smetvägen",
72
+ "company_zip": "12345",
73
+ "company_city": "Uppsala",
74
+ "company_country": "SWEDEN",
75
+ "company_vat": "",
76
+ "company_contact": "Jane Doe",
77
+ "company_email": "jane.doe@example.com",
78
+ "currency_id": 1,
79
+ "currency_exchange_rate": 1,
80
+ "currency_amount": 2000,
81
+ "payment_status": 1,
82
+ "approval_status": 2,
83
+ "status": 1,
84
+ "full_payment_date_time": "0000-00-00 00:00:00",
85
+ "sent": "0000-00-00 00:00:00",
86
+ "created_at": "2016-04-06 11:45:00",
87
+ "note": null,
88
+ "supplier_ledger_date_time": "0000-00-00 00:00:00",
89
+ "extra_security": 0,
90
+ "send_to_email": "jane.doe@example.com",
91
+ "saved_invoice_created_at": "0000-00-00 00:00:00",
92
+ "api_consumer_id": 0,
93
+ "special_tax_id": 0
94
+ },
95
+ "links": {
96
+ "self": "https://frilansfinans.se/api/invoice/2"
97
+ }
98
+ }
99
+ ],
100
+ "meta": {
101
+ "pagination": {
102
+ "page": {
103
+ "size": 25,
104
+ "number": 1,
105
+ "items": 25
106
+ },
107
+ "items": 2,
108
+ "pages": 1
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "data": {
3
+ "type": "professions",
4
+ "id": "1",
5
+ "attributes": {
6
+ "title": "Test profession",
7
+ "ssyk": 1,
8
+ "insurance_status_id": 1
9
+ },
10
+ "links": {
11
+ "self": "https://frilansfinans.se/api/profession/1"
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "professions",
5
+ "id": "1",
6
+ "attributes": {
7
+ "title": "3D-designer",
8
+ "language_id": 1,
9
+ "ssyk": 3471,
10
+ "insurance_status_id": 1
11
+ },
12
+ "links": {
13
+ "self": "https://frilansfinans.se/api/profession/1"
14
+ }
15
+ },
16
+ {
17
+ "type": "professions",
18
+ "id": "2",
19
+ "attributes": {
20
+ "title": "3D-grafiker",
21
+ "language_id": 1,
22
+ "ssyk": 3471,
23
+ "insurance_status_id": 1
24
+ },
25
+ "links": {
26
+ "self": "https://frilansfinans.se/api/profession/2"
27
+ }
28
+ },
29
+ {
30
+ "type": "professions",
31
+ "id": "3",
32
+ "attributes": {
33
+ "title": "3D-visualiserare",
34
+ "language_id": 1,
35
+ "ssyk": 3471,
36
+ "insurance_status_id": 1
37
+ },
38
+ "links": {
39
+ "self": "https://frilansfinans.se/api/profession/3"
40
+ }
41
+ },
42
+ {
43
+ "type": "professions",
44
+ "id": "4",
45
+ "attributes": {
46
+ "title": "Abonnemangsförsäljare",
47
+ "language_id": 1,
48
+ "ssyk": 5227,
49
+ "insurance_status_id": 1
50
+ },
51
+ "links": {
52
+ "self": "https://frilansfinans.se/api/profession/4"
53
+ }
54
+ },
55
+ {
56
+ "type": "professions",
57
+ "id": "5",
58
+ "attributes": {
59
+ "title": "Abonnemangskontorist",
60
+ "language_id": 1,
61
+ "ssyk": 4190,
62
+ "insurance_status_id": 1
63
+ },
64
+ "links": {
65
+ "self": "https://frilansfinans.se/api/profession/5"
66
+ }
67
+ },
68
+ {
69
+ "type": "professions",
70
+ "id": "6",
71
+ "attributes": {
72
+ "title": "Abonnentingenjör, vatten och avlopp",
73
+ "language_id": 1,
74
+ "ssyk": 3115,
75
+ "insurance_status_id": 1
76
+ },
77
+ "links": {
78
+ "self": "https://frilansfinans.se/api/profession/6"
79
+ }
80
+ },
81
+ {
82
+ "type": "professions",
83
+ "id": "7",
84
+ "attributes": {
85
+ "title": "Abonnentman",
86
+ "language_id": 1,
87
+ "ssyk": 4190,
88
+ "insurance_status_id": 1
89
+ },
90
+ "links": {
91
+ "self": "https://frilansfinans.se/api/profession/7"
92
+ }
93
+ },
94
+ {
95
+ "type": "professions",
96
+ "id": "8",
97
+ "attributes": {
98
+ "title": "Account manager",
99
+ "language_id": 1,
100
+ "ssyk": 3415,
101
+ "insurance_status_id": 1
102
+ },
103
+ "links": {
104
+ "self": "https://frilansfinans.se/api/profession/8"
105
+ }
106
+ },
107
+ {
108
+ "type": "professions",
109
+ "id": "9",
110
+ "attributes": {
111
+ "title": "Accounting controller",
112
+ "language_id": 1,
113
+ "ssyk": 2411,
114
+ "insurance_status_id": 2
115
+ },
116
+ "links": {
117
+ "self": "https://frilansfinans.se/api/profession/9"
118
+ }
119
+ },
120
+ {
121
+ "type": "professions",
122
+ "id": "10",
123
+ "attributes": {
124
+ "title": "Ackompanjatör, klassisk musik",
125
+ "language_id": 1,
126
+ "ssyk": 2453,
127
+ "insurance_status_id": 3
128
+ },
129
+ "links": {
130
+ "self": "https://frilansfinans.se/api/profession/10"
131
+ }
132
+ }
133
+ ],
134
+ "links": {
135
+ "first": "https://frilansfinans.se/api/professions",
136
+ "next": "https://frilansfinans.se/api/professions?page%5Bnumber%5D=2",
137
+ "last": "https://frilansfinans.se/api/professions?page%5Bnumber%5D=38"
138
+ },
139
+ "meta": {
140
+ "pagination": {
141
+ "page": {
142
+ "size": 25,
143
+ "number": 1,
144
+ "items": 25
145
+ },
146
+ "items": 1066,
147
+ "pages": 331
148
+ }
149
+ }
150
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "type": "salaries",
5
+ "id": "2",
6
+ "attributes": {
7
+ "allowance": 0,
8
+ "travel": 0,
9
+ "user_id": 3,
10
+ "invoice_id": 1,
11
+ "taxkey_id": 4,
12
+ "net_amount": 1400,
13
+ "gross_amount": 2000,
14
+ "gross_old": 2800,
15
+ "to_pay": 1400,
16
+ "tax_amount": 600,
17
+ "payment_status": 2,
18
+ "category_id": 1,
19
+ "paid_at": "2016-11-16 16:25:27",
20
+ "planned_payment_at": "2016-11-16",
21
+ "created_at": "2016-11-09 12:31:01",
22
+ "resent_status": 0
23
+ },
24
+ "links": {
25
+ "self": "http://api.frilansfinans.se/salary/2"
26
+ }
27
+ }
28
+ ],
29
+ "meta": {
30
+ "pagination": {
31
+ "page": {
32
+ "size": 25,
33
+ "number": 1,
34
+ "items": 25
35
+ },
36
+ "items": 1,
37
+ "pages": 331
38
+ }
39
+ },
40
+ "links": {
41
+ "self": "http://api.frilansfinans.se/invoices/1/salaries?page=1",
42
+ "first": "http://api.frilansfinans.se/invoices/1/salaries?page=1",
43
+ "last": "http://api.frilansfinans.se/invoices/1/salaries?page=1"
44
+ }
45
+ }