freeagent 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/LICENSE +22 -0
- data/README.rdoc +27 -0
- data/Rakefile +28 -0
- data/freeagent.gemspec +27 -0
- data/lib/free_agent.rb +64 -0
- data/lib/free_agent/attachment.rb +21 -0
- data/lib/free_agent/bank_account.rb +7 -0
- data/lib/free_agent/base.rb +6 -0
- data/lib/free_agent/bill.rb +15 -0
- data/lib/free_agent/contact.rb +7 -0
- data/lib/free_agent/invoice.rb +7 -0
- data/lib/free_agent/invoice_item.rb +10 -0
- data/lib/free_agent/project.rb +7 -0
- data/lib/free_agent/version.rb +16 -0
- data/lib/freeagent.rb +1 -0
- data/spec/fixtures/attachments/all.xml +23 -0
- data/spec/fixtures/attachments/single.xml +11 -0
- data/spec/fixtures/bank_accounts/all.xml +35 -0
- data/spec/fixtures/bank_accounts/single.xml +15 -0
- data/spec/fixtures/bills/all.xml +37 -0
- data/spec/fixtures/bills/single.xml +18 -0
- data/spec/fixtures/contacts/all.xml +47 -0
- data/spec/fixtures/contacts/single.xml +23 -0
- data/spec/fixtures/invoice_items/all.xml +15 -0
- data/spec/fixtures/invoice_items/single.xml +13 -0
- data/spec/fixtures/invoices/all.xml +75 -0
- data/spec/fixtures/invoices/single.xml +37 -0
- data/spec/fixtures/projects/all.xml +25 -0
- data/spec/fixtures/projects/single.xml +23 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/helper.rb +18 -0
- data/spec/support/mimic.rb +47 -0
- data/spec/unit/attachment_spec.rb +56 -0
- data/spec/unit/bank_account_spec.rb +56 -0
- data/spec/unit/base_spec.rb +9 -0
- data/spec/unit/bill_spec.rb +66 -0
- data/spec/unit/contact_spec.rb +56 -0
- data/spec/unit/freeagent_spec.rb +54 -0
- data/spec/unit/invoice_item_spec.rb +77 -0
- data/spec/unit/invoice_spec.rb +56 -0
- data/spec/unit/project_spec.rb +56 -0
- metadata +169 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<bank-account>
|
3
|
+
<id type="integer">85327</id>
|
4
|
+
<type>StandardBankAccount</type>
|
5
|
+
<name>Business Checking Account</name>
|
6
|
+
<account-number>00000000</account-number>
|
7
|
+
<sort-code>00000000</sort-code>
|
8
|
+
<secondary-sort-code></secondary-sort-code>
|
9
|
+
<iban></iban>
|
10
|
+
<bic></bic>
|
11
|
+
<current-balance type="decimal">5571.18</current-balance>
|
12
|
+
<current-balance-date type="datetime">2011-04-04</current-balance-date>
|
13
|
+
<opening-balance type="decimal">4733.42</opening-balance>
|
14
|
+
<is-personal>false</is-personal>
|
15
|
+
</bank-account>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<bills type="array">
|
3
|
+
<bill>
|
4
|
+
<id type="integer">157528</id>
|
5
|
+
<contact-id type="integer">436186</contact-id>
|
6
|
+
<reference>USD122</reference>
|
7
|
+
<dated-on type="datetime">2011-04-01T00:00:00+00:00</dated-on>
|
8
|
+
<due-date type="datetime">2011-04-30T00:00:00+00:00</due-date>
|
9
|
+
<bill-type>Accountancy Fees</bill-type>
|
10
|
+
<comments>To be paid ASAP.</comments>
|
11
|
+
<depreciation-schedule>3 Years</depreciation-schedule>
|
12
|
+
<total-value type="decimal">140.0</total-value>
|
13
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
14
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
15
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
16
|
+
<manual-sales-tax-amount type="decimal">0.0</manual-sales-tax-amount>
|
17
|
+
<recurring></recurring>
|
18
|
+
<status>Open</status>
|
19
|
+
</bill>
|
20
|
+
<bill>
|
21
|
+
<id type="integer">157514</id>
|
22
|
+
<contact-id type="integer">436186</contact-id>
|
23
|
+
<reference>USD100</reference>
|
24
|
+
<dated-on type="datetime">2011-01-04T00:00:00+00:00</dated-on>
|
25
|
+
<due-date type="datetime">2011-01-31T00:00:00+00:00</due-date>
|
26
|
+
<bill-type>Accountancy Fees</bill-type>
|
27
|
+
<comments></comments>
|
28
|
+
<depreciation-schedule>3 Years</depreciation-schedule>
|
29
|
+
<total-value type="decimal">5000.0</total-value>
|
30
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
31
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
32
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
33
|
+
<manual-sales-tax-amount type="decimal">0.0</manual-sales-tax-amount>
|
34
|
+
<recurring></recurring>
|
35
|
+
<status>Paid</status>
|
36
|
+
</bill>
|
37
|
+
</bills>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<bill>
|
3
|
+
<id type="integer">157514</id>
|
4
|
+
<contact-id type="integer">436186</contact-id>
|
5
|
+
<reference>USD100</reference>
|
6
|
+
<dated-on type="datetime">2011-01-04T00:00:00+00:00</dated-on>
|
7
|
+
<due-date type="datetime">2011-01-31T00:00:00+00:00</due-date>
|
8
|
+
<bill-type>Accountancy Fees</bill-type>
|
9
|
+
<comments></comments>
|
10
|
+
<depreciation-schedule>3 Years</depreciation-schedule>
|
11
|
+
<total-value type="decimal">5000.0</total-value>
|
12
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
13
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
14
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
15
|
+
<manual-sales-tax-amount type="decimal">0.0</manual-sales-tax-amount>
|
16
|
+
<recurring></recurring>
|
17
|
+
<status>Paid</status>
|
18
|
+
</bill>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<contacts type="array">
|
3
|
+
<contact>
|
4
|
+
<id type="integer">433858</id>
|
5
|
+
<organisation-name></organisation-name>
|
6
|
+
<first-name>John</first-name>
|
7
|
+
<last-name>Doe</last-name>
|
8
|
+
<email>john@example.com</email>
|
9
|
+
<billing-email></billing-email>
|
10
|
+
<phone-number></phone-number>
|
11
|
+
<address1></address1>
|
12
|
+
<town></town>
|
13
|
+
<region></region>
|
14
|
+
<postcode></postcode>
|
15
|
+
<address2></address2>
|
16
|
+
<address3></address3>
|
17
|
+
<contact-name-on-invoices type="boolean">true</contact-name-on-invoices>
|
18
|
+
<country>Italy</country>
|
19
|
+
<sales-tax-registration-number></sales-tax-registration-number>
|
20
|
+
<locale>en</locale>
|
21
|
+
<mobile></mobile>
|
22
|
+
<account-balance>0.0</account-balance>
|
23
|
+
<uses-contact-invoice-sequence type="boolean">false</uses-contact-invoice-sequence>
|
24
|
+
</contact>
|
25
|
+
<contact>
|
26
|
+
<id type="integer">436186</id>
|
27
|
+
<organisation-name>Wonderland</organisation-name>
|
28
|
+
<first-name>Alice</first-name>
|
29
|
+
<last-name></last-name>
|
30
|
+
<email></email>
|
31
|
+
<billing-email></billing-email>
|
32
|
+
<phone-number></phone-number>
|
33
|
+
<address1></address1>
|
34
|
+
<town></town>
|
35
|
+
<region></region>
|
36
|
+
<postcode></postcode>
|
37
|
+
<address2></address2>
|
38
|
+
<address3></address3>
|
39
|
+
<contact-name-on-invoices type="boolean">true</contact-name-on-invoices>
|
40
|
+
<country>Italy</country>
|
41
|
+
<sales-tax-registration-number></sales-tax-registration-number>
|
42
|
+
<locale>en</locale>
|
43
|
+
<mobile></mobile>
|
44
|
+
<account-balance>0.0</account-balance>
|
45
|
+
<uses-contact-invoice-sequence type="boolean">false</uses-contact-invoice-sequence>
|
46
|
+
</contact>
|
47
|
+
</contacts>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<contact>
|
3
|
+
<id type="integer">436186</id>
|
4
|
+
<organisation-name>Wonderland</organisation-name>
|
5
|
+
<first-name>Alice</first-name>
|
6
|
+
<last-name></last-name>
|
7
|
+
<email></email>
|
8
|
+
<billing-email></billing-email>
|
9
|
+
<phone-number></phone-number>
|
10
|
+
<address1></address1>
|
11
|
+
<town></town>
|
12
|
+
<region></region>
|
13
|
+
<postcode></postcode>
|
14
|
+
<address2></address2>
|
15
|
+
<address3></address3>
|
16
|
+
<contact-name-on-invoices type="boolean">true</contact-name-on-invoices>
|
17
|
+
<country>Italy</country>
|
18
|
+
<sales-tax-registration-number></sales-tax-registration-number>
|
19
|
+
<locale>en</locale>
|
20
|
+
<mobile></mobile>
|
21
|
+
<account-balance>0.0</account-balance>
|
22
|
+
<uses-contact-invoice-sequence type="boolean">false</uses-contact-invoice-sequence>
|
23
|
+
</contact>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<invoice-items type="array">
|
3
|
+
<invoice-item>
|
4
|
+
<id type="integer">3257802</id>
|
5
|
+
<description>Domains April.</description>
|
6
|
+
<project-id type="integer" nil="true"></project-id>
|
7
|
+
<invoice-id type="integer">2593747</invoice-id>
|
8
|
+
<item-type>-no unit-</item-type>
|
9
|
+
<price type="decimal">0.4</price>
|
10
|
+
<quantity type="decimal">40.0</quantity>
|
11
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
12
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
13
|
+
<nominal-code>001</nominal-code>
|
14
|
+
</invoice-item>
|
15
|
+
</invoice-items>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<invoice-item>
|
3
|
+
<id type="integer">3257802</id>
|
4
|
+
<description>Domains April.</description>
|
5
|
+
<project-id type="integer" nil="true"></project-id>
|
6
|
+
<invoice-id type="integer">2593747</invoice-id>
|
7
|
+
<item-type>-no unit-</item-type>
|
8
|
+
<price type="decimal">0.4</price>
|
9
|
+
<quantity type="decimal">40.0</quantity>
|
10
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
11
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
12
|
+
<nominal-code>001</nominal-code>
|
13
|
+
</invoice-item>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<invoices type="array">
|
3
|
+
<invoice>
|
4
|
+
<id type="integer">2593747</id>
|
5
|
+
<company-id type="integer">46313</company-id>
|
6
|
+
<project-id type="integer"></project-id>
|
7
|
+
<contact-id type="integer">433858</contact-id>
|
8
|
+
<dated-on type="datetime">2011-04-09T00:00:00Z</dated-on>
|
9
|
+
<due-on type="datetime">2011-04-09T00:00:00Z</due-on>
|
10
|
+
<reference>001</reference>
|
11
|
+
<currency>EUR</currency>
|
12
|
+
<exchange-rate>1.0</exchange-rate>
|
13
|
+
<net-value type="decimal">16.0</net-value>
|
14
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
15
|
+
<second-sales-tax-value type="decimal">0.0</second-sales-tax-value>
|
16
|
+
<status>Paid</status>
|
17
|
+
<comments></comments>
|
18
|
+
<discount-percent type="decimal"></discount-percent>
|
19
|
+
<po-reference></po-reference>
|
20
|
+
<omit-header type="boolean">false</omit-header>
|
21
|
+
<payment-terms-in-days type="integer">0</payment-terms-in-days>
|
22
|
+
<written-off-date type="datetime"></written-off-date>
|
23
|
+
<ec-status></ec-status>
|
24
|
+
<invoice-items type="array">
|
25
|
+
<invoice-item>
|
26
|
+
<id type="integer">3257802</id>
|
27
|
+
<description>Monthly fee.</description>
|
28
|
+
<project-id type="integer" nil="true"></project-id>
|
29
|
+
<invoice-id type="integer">2593747</invoice-id>
|
30
|
+
<item-type>-no unit-</item-type>
|
31
|
+
<price type="decimal">0.4</price>
|
32
|
+
<quantity type="decimal">40.0</quantity>
|
33
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
34
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
35
|
+
<nominal-code>001</nominal-code>
|
36
|
+
</invoice-item>
|
37
|
+
</invoice-items>
|
38
|
+
</invoice>
|
39
|
+
<invoice>
|
40
|
+
<id type="integer">2593795</id>
|
41
|
+
<company-id type="integer">46313</company-id>
|
42
|
+
<project-id type="integer"></project-id>
|
43
|
+
<contact-id type="integer">433858</contact-id>
|
44
|
+
<dated-on type="datetime">2011-04-09T00:00:00Z</dated-on>
|
45
|
+
<due-on type="datetime">2011-04-09T00:00:00Z</due-on>
|
46
|
+
<reference>003</reference>
|
47
|
+
<currency>USD</currency>
|
48
|
+
<exchange-rate>0.69044088</exchange-rate>
|
49
|
+
<net-value type="decimal">0.4</net-value>
|
50
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
51
|
+
<second-sales-tax-value type="decimal">0.0</second-sales-tax-value>
|
52
|
+
<status>Draft</status>
|
53
|
+
<comments></comments>
|
54
|
+
<discount-percent type="decimal"></discount-percent>
|
55
|
+
<po-reference></po-reference>
|
56
|
+
<omit-header type="boolean">false</omit-header>
|
57
|
+
<payment-terms-in-days type="integer">0</payment-terms-in-days>
|
58
|
+
<written-off-date type="datetime"></written-off-date>
|
59
|
+
<ec-status></ec-status>
|
60
|
+
<invoice-items type="array">
|
61
|
+
<invoice-item>
|
62
|
+
<id type="integer">3257875</id>
|
63
|
+
<description>Monthly fee.</description>
|
64
|
+
<project-id type="integer" nil="true"></project-id>
|
65
|
+
<invoice-id type="integer">2593795</invoice-id>
|
66
|
+
<item-type>-no unit-</item-type>
|
67
|
+
<price type="decimal">0.4</price>
|
68
|
+
<quantity type="decimal">1.0</quantity>
|
69
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
70
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
71
|
+
<nominal-code>001</nominal-code>
|
72
|
+
</invoice-item>
|
73
|
+
</invoice-items>
|
74
|
+
</invoice>
|
75
|
+
</invoices>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<invoice>
|
3
|
+
<id type="integer">2593747</id>
|
4
|
+
<company-id type="integer">46313</company-id>
|
5
|
+
<project-id type="integer"></project-id>
|
6
|
+
<contact-id type="integer">433858</contact-id>
|
7
|
+
<dated-on type="datetime">2011-04-09T00:00:00Z</dated-on>
|
8
|
+
<due-on type="datetime">2011-04-09T00:00:00Z</due-on>
|
9
|
+
<reference>001</reference>
|
10
|
+
<currency>EUR</currency>
|
11
|
+
<exchange-rate>1.0</exchange-rate>
|
12
|
+
<net-value type="decimal">16.0</net-value>
|
13
|
+
<sales-tax-value type="decimal">0.0</sales-tax-value>
|
14
|
+
<second-sales-tax-value type="decimal">0.0</second-sales-tax-value>
|
15
|
+
<status>Paid</status>
|
16
|
+
<comments></comments>
|
17
|
+
<discount-percent type="decimal"></discount-percent>
|
18
|
+
<po-reference></po-reference>
|
19
|
+
<omit-header type="boolean">false</omit-header>
|
20
|
+
<payment-terms-in-days type="integer">0</payment-terms-in-days>
|
21
|
+
<written-off-date type="datetime"></written-off-date>
|
22
|
+
<ec-status></ec-status>
|
23
|
+
<invoice-items type="array">
|
24
|
+
<invoice-item>
|
25
|
+
<id type="integer">3257802</id>
|
26
|
+
<description>Monthly fee.</description>
|
27
|
+
<project-id type="integer" nil="true"></project-id>
|
28
|
+
<invoice-id type="integer">2593747</invoice-id>
|
29
|
+
<item-type>-no unit-</item-type>
|
30
|
+
<price type="decimal">0.4</price>
|
31
|
+
<quantity type="decimal">40.0</quantity>
|
32
|
+
<sales-tax-rate type="decimal">0.0</sales-tax-rate>
|
33
|
+
<second-sales-tax-rate type="decimal">0.0</second-sales-tax-rate>
|
34
|
+
<nominal-code>001</nominal-code>
|
35
|
+
</invoice-item>
|
36
|
+
</invoice-items>
|
37
|
+
</invoice>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projects type="array">
|
3
|
+
<project>
|
4
|
+
<id type="integer">116526</id>
|
5
|
+
<contact-id type="integer">436186</contact-id>
|
6
|
+
<name>Website</name>
|
7
|
+
<currency>USD</currency>
|
8
|
+
<status>Active</status>
|
9
|
+
<starts-on type="date"></starts-on>
|
10
|
+
<ends-on type="date"></ends-on>
|
11
|
+
<billing-basis type="decimal">8.0</billing-basis>
|
12
|
+
<hours-per-day type="decimal">8.0</hours-per-day>
|
13
|
+
<billing-period>hour</billing-period>
|
14
|
+
<normal-billing-rate>0.0</normal-billing-rate>
|
15
|
+
<budget type="integer">1000</budget>
|
16
|
+
<budget-units>Monetary</budget-units>
|
17
|
+
<uses-project-invoice-sequence type="boolean">false</uses-project-invoice-sequence>
|
18
|
+
<contacts-po-reference></contacts-po-reference>
|
19
|
+
<is-ir35 type="boolean"></is-ir35>
|
20
|
+
<notes-count type="integer">1</notes-count>
|
21
|
+
<basecamp-id type="integer"></basecamp-id>
|
22
|
+
<created-at type="datetime">2011-04-12T18:33:06Z</created-at>
|
23
|
+
<updated-at type="datetime">2011-04-12T18:33:06Z</updated-at>
|
24
|
+
</project>
|
25
|
+
</projects>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<id type="integer">116526</id>
|
4
|
+
<contact-id type="integer">436186</contact-id>
|
5
|
+
<name>Website</name>
|
6
|
+
<currency>USD</currency>
|
7
|
+
<status>Active</status>
|
8
|
+
<starts-on type="date"></starts-on>
|
9
|
+
<ends-on type="date"></ends-on>
|
10
|
+
<billing-basis type="decimal">8.0</billing-basis>
|
11
|
+
<hours-per-day type="decimal">8.0</hours-per-day>
|
12
|
+
<billing-period>hour</billing-period>
|
13
|
+
<normal-billing-rate>0.0</normal-billing-rate>
|
14
|
+
<budget type="integer">1000</budget>
|
15
|
+
<budget-units>Monetary</budget-units>
|
16
|
+
<uses-project-invoice-sequence type="boolean">false</uses-project-invoice-sequence>
|
17
|
+
<contacts-po-reference></contacts-po-reference>
|
18
|
+
<is-ir35 type="boolean"></is-ir35>
|
19
|
+
<notes-count type="integer">1</notes-count>
|
20
|
+
<basecamp-id type="integer"></basecamp-id>
|
21
|
+
<created-at type="datetime">2011-04-12T18:33:06Z</created-at>
|
22
|
+
<updated-at type="datetime">2011-04-12T18:33:06Z</updated-at>
|
23
|
+
</project>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'freeagent'
|
3
|
+
|
4
|
+
unless defined?(SPEC_ROOT)
|
5
|
+
SPEC_ROOT = File.expand_path("../", __FILE__)
|
6
|
+
end
|
7
|
+
|
8
|
+
# The fixtures are UTF-8 encoded.
|
9
|
+
# Make sure Ruby uses the proper encoding.
|
10
|
+
if RUBY_VERSION < '1.9'
|
11
|
+
$KCODE='u'
|
12
|
+
else
|
13
|
+
Encoding.default_external = Encoding::UTF_8
|
14
|
+
Encoding.default_internal = Encoding::UTF_8
|
15
|
+
end
|
16
|
+
|
17
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
18
|
+
# in spec/support/ and its subdirectories.
|
19
|
+
Dir[File.join(SPEC_ROOT, "support/**/*.rb")].each { |f| require f }
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# config.mock_with :rr
|
23
|
+
|
24
|
+
config.before(:each) do
|
25
|
+
FreeAgent.configure do |config|
|
26
|
+
config.username = "email@example.com"
|
27
|
+
config.password = "letmein"
|
28
|
+
config.subdomain = "example"
|
29
|
+
end
|
30
|
+
|
31
|
+
FreeAgent::Base.site = "http://localhost:11988"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Helper
|
2
|
+
|
3
|
+
# Gets the currently described class.
|
4
|
+
# Conversely to +subject+, it returns the class
|
5
|
+
# instead of an instance.
|
6
|
+
def klass
|
7
|
+
described_class
|
8
|
+
end
|
9
|
+
|
10
|
+
def fixture(*name)
|
11
|
+
File.join(SPEC_ROOT, "fixtures", *name)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.include Helper
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'mimic'
|
2
|
+
|
3
|
+
def fixture(*path)
|
4
|
+
File.read(File.join(SPEC_ROOT, 'fixtures', *path))
|
5
|
+
end
|
6
|
+
|
7
|
+
Mimic.mimic do
|
8
|
+
|
9
|
+
use Rack::Auth::Basic do |username, password|
|
10
|
+
username == 'email@example.com' and password == 'letmein'
|
11
|
+
end
|
12
|
+
|
13
|
+
get('/attachments.xml').returning fixture('attachments/all.xml')
|
14
|
+
get('/attachments/1.xml').returning "", 404
|
15
|
+
get('/attachments/2.xml').returning fixture('attachments/single.xml')
|
16
|
+
|
17
|
+
get('/bank_accounts.xml').returning fixture('bank_accounts/all.xml')
|
18
|
+
get('/bank_accounts/1.xml').returning "", 404
|
19
|
+
get('/bank_accounts/2.xml').returning fixture('bank_accounts/single.xml')
|
20
|
+
|
21
|
+
get('/bills.xml') do
|
22
|
+
return [400, {}, []] unless params[:period]
|
23
|
+
|
24
|
+
[200, {}, fixture('bills/all.xml')]
|
25
|
+
end
|
26
|
+
get('/bills/1.xml').returning "", 404
|
27
|
+
get('/bills/2.xml').returning fixture('bills/single.xml')
|
28
|
+
|
29
|
+
get('/contacts.xml').returning fixture('contacts/all.xml')
|
30
|
+
get('/contacts/1.xml').returning "", 404
|
31
|
+
get('/contacts/2.xml').returning fixture('contacts/single.xml')
|
32
|
+
|
33
|
+
get('/invoices.xml').returning fixture('invoices/all.xml')
|
34
|
+
get('/invoices/1.xml').returning "", 404
|
35
|
+
get('/invoices/2.xml').returning fixture('invoices/single.xml')
|
36
|
+
|
37
|
+
get('/invoices/1/*') do
|
38
|
+
[404, {}, []]
|
39
|
+
end
|
40
|
+
get('/invoices/2/invoice_items.xml').returning fixture('invoice_items/all.xml')
|
41
|
+
get('/invoices/2/invoice_items/1.xml').returning "", 404
|
42
|
+
get('/invoices/2/invoice_items/2.xml').returning fixture('invoice_items/single.xml')
|
43
|
+
|
44
|
+
get('/projects.xml').returning fixture('projects/all.xml')
|
45
|
+
get('/projects/1.xml').returning "", 404
|
46
|
+
get('/projects/2.xml').returning fixture('projects/single.xml')
|
47
|
+
end
|