invoicexpress 0.0.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.
Files changed (97) hide show
  1. data/CHANGELOG.md +0 -0
  2. data/README.md +322 -0
  3. data/Rakefile +19 -0
  4. data/invoicexpress.gemspec +26 -0
  5. data/lib/faraday/response/parse_xml.rb +23 -0
  6. data/lib/faraday/response/raise_invoicexpress_errors.rb +20 -0
  7. data/lib/invoicexpress.rb +26 -0
  8. data/lib/invoicexpress/authentication.rb +15 -0
  9. data/lib/invoicexpress/client.rb +56 -0
  10. data/lib/invoicexpress/client/cash_invoices.rb +110 -0
  11. data/lib/invoicexpress/client/charts.rb +57 -0
  12. data/lib/invoicexpress/client/clients.rb +215 -0
  13. data/lib/invoicexpress/client/credit_notes.rb +128 -0
  14. data/lib/invoicexpress/client/debit_notes.rb +129 -0
  15. data/lib/invoicexpress/client/invoices.rb +107 -0
  16. data/lib/invoicexpress/client/items.rb +82 -0
  17. data/lib/invoicexpress/client/purchase_orders.rb +126 -0
  18. data/lib/invoicexpress/client/schedules.rb +110 -0
  19. data/lib/invoicexpress/client/sequences.rb +71 -0
  20. data/lib/invoicexpress/client/simplified_invoices.rb +130 -0
  21. data/lib/invoicexpress/client/taxes.rb +82 -0
  22. data/lib/invoicexpress/client/users.rb +48 -0
  23. data/lib/invoicexpress/configuration.rb +51 -0
  24. data/lib/invoicexpress/connection.rb +40 -0
  25. data/lib/invoicexpress/error.rb +68 -0
  26. data/lib/invoicexpress/models.rb +29 -0
  27. data/lib/invoicexpress/models/chart.rb +41 -0
  28. data/lib/invoicexpress/models/client.rb +24 -0
  29. data/lib/invoicexpress/models/filter.rb +60 -0
  30. data/lib/invoicexpress/models/invoice.rb +235 -0
  31. data/lib/invoicexpress/models/purchase_order.rb +72 -0
  32. data/lib/invoicexpress/models/quarterly_result.rb +45 -0
  33. data/lib/invoicexpress/models/schedule.rb +87 -0
  34. data/lib/invoicexpress/models/sequence.rb +17 -0
  35. data/lib/invoicexpress/models/supplier.rb +17 -0
  36. data/lib/invoicexpress/models/top_client.rb +15 -0
  37. data/lib/invoicexpress/models/top_debtor.rb +14 -0
  38. data/lib/invoicexpress/models/user.rb +31 -0
  39. data/lib/invoicexpress/request.rb +63 -0
  40. data/lib/invoicexpress/version.rb +3 -0
  41. data/spec/fixtures/charts.invoicing.xml +21 -0
  42. data/spec/fixtures/charts.quarterly-results.xml +25 -0
  43. data/spec/fixtures/charts.top-clients.xml +10 -0
  44. data/spec/fixtures/charts.top-debtors.xml +10 -0
  45. data/spec/fixtures/charts.treasury.xml +49 -0
  46. data/spec/fixtures/clients.create.xml +6 -0
  47. data/spec/fixtures/clients.get.xml +21 -0
  48. data/spec/fixtures/clients.invoices.xml +11 -0
  49. data/spec/fixtures/clients.list.xml +18 -0
  50. data/spec/fixtures/clients.update.xml +1 -0
  51. data/spec/fixtures/credit_notes.create.xml +53 -0
  52. data/spec/fixtures/credit_notes.email_document.xml +9 -0
  53. data/spec/fixtures/credit_notes.list.xml +114 -0
  54. data/spec/fixtures/credit_notes.update_state.xml +7 -0
  55. data/spec/fixtures/invoices.create.xml +37 -0
  56. data/spec/fixtures/invoices.get.xml +50 -0
  57. data/spec/fixtures/invoices.list.xml +537 -0
  58. data/spec/fixtures/invoices.update_state.xml +7 -0
  59. data/spec/fixtures/ok.xml +0 -0
  60. data/spec/fixtures/po.create.xml +42 -0
  61. data/spec/fixtures/po.email_document.xml +0 -0
  62. data/spec/fixtures/po.get.xml +42 -0
  63. data/spec/fixtures/po.list.xml +44 -0
  64. data/spec/fixtures/po.update_state.xml +7 -0
  65. data/spec/fixtures/schedules.create.xml +48 -0
  66. data/spec/fixtures/schedules.get.xml +57 -0
  67. data/spec/fixtures/schedules.list.xml +40 -0
  68. data/spec/fixtures/sequences.create.xml +9 -0
  69. data/spec/fixtures/sequences.get.xml +10 -0
  70. data/spec/fixtures/sequences.list.xml +12 -0
  71. data/spec/fixtures/sequences.update.xml +10 -0
  72. data/spec/fixtures/simplified_invoices.create.xml +53 -0
  73. data/spec/fixtures/simplified_invoices.email_document.xml +9 -0
  74. data/spec/fixtures/simplified_invoices.get.xml +74 -0
  75. data/spec/fixtures/simplified_invoices.list.xml +114 -0
  76. data/spec/fixtures/simplified_invoices.update.xml +0 -0
  77. data/spec/fixtures/simplified_invoices.update_state.xml +7 -0
  78. data/spec/fixtures/taxes.create.xml +7 -0
  79. data/spec/fixtures/taxes.list.xml +18 -0
  80. data/spec/fixtures/taxes.update.xml +7 -0
  81. data/spec/fixtures/users.accounts.xml +12 -0
  82. data/spec/fixtures/users.change-account.xml +0 -0
  83. data/spec/fixtures/users.login.xml +11 -0
  84. data/spec/helper.rb +62 -0
  85. data/spec/invoicexpress/client/charts_spec.rb +69 -0
  86. data/spec/invoicexpress/client/clients_spec.rb +108 -0
  87. data/spec/invoicexpress/client/credit_notes_spec.rb +104 -0
  88. data/spec/invoicexpress/client/invoices_spec.rb +110 -0
  89. data/spec/invoicexpress/client/purchase_orders_spec.rb +116 -0
  90. data/spec/invoicexpress/client/schedules_spec.rb +111 -0
  91. data/spec/invoicexpress/client/sequences_spec.rb +68 -0
  92. data/spec/invoicexpress/client/simplified_invoices_spec.rb +116 -0
  93. data/spec/invoicexpress/client/taxes_spec.rb +70 -0
  94. data/spec/invoicexpress/client/users_spec.rb +40 -0
  95. data/spec/invoicexpress/client_spec.rb +24 -0
  96. data/spec/invoicexpress_spec.rb +19 -0
  97. metadata +279 -0
@@ -0,0 +1,110 @@
1
+ require 'helper'
2
+
3
+ describe Invoicexpress::Client::Invoices do
4
+ before do
5
+ @client = Invoicexpress::Client.new(:screen_name => "thinkorangeteste")
6
+ end
7
+
8
+ describe ".invoices" do
9
+ it "Returns all the invoice" do
10
+ stub_get("/invoices.xml?page=1").
11
+ to_return(xml_response("invoices.list.xml"))
12
+
13
+ items = @client.invoices
14
+ items.invoices.count.should == 10
15
+ items.current_page==1
16
+ end
17
+ end
18
+
19
+ describe ".create_invoice" do
20
+ it "creates a new invoice" do
21
+ stub_post("/invoices.xml").
22
+ to_return(xml_response("invoices.create.xml"))
23
+
24
+
25
+ object = Invoicexpress::Models::Invoice.new(
26
+ :date => Date.new(2013, 6, 18),
27
+ :due_date => Date.new(2013, 6, 18),
28
+ :tax_exemption => "M01",
29
+ :client => Invoicexpress::Models::Client.new(
30
+ :name => "Ruben Fonseca"
31
+ ),
32
+ :items => [
33
+ Invoicexpress::Models::Item.new(
34
+ :name => "Item 1",
35
+ :unit_price => 30,
36
+ :quantity => 1,
37
+ :unit => "unit",
38
+ )
39
+ ]
40
+ )
41
+
42
+ item = @client.create_invoice(object)
43
+ item.id.should == 1503698
44
+ item.status == "draft"
45
+ end
46
+ end
47
+
48
+ describe ".invoice" do
49
+ it "gets a invoice" do
50
+ stub_get("/invoices/1503698.xml").
51
+ to_return(xml_response("invoices.get.xml"))
52
+
53
+ item = @client.invoice(1503698)
54
+ item.status.should == "draft"
55
+ item.client.id.should == 501854
56
+ end
57
+ end
58
+
59
+ describe ".update_invoice" do
60
+ it "updates the invoice" do
61
+ stub_put("/invoices/1503698.xml").
62
+ to_return(xml_response("ok.xml"))
63
+
64
+ model = Invoicexpress::Models::Invoice.new(:id => 1503698)
65
+ expect { @client.update_invoice(model) }.to_not raise_error
66
+ end
67
+
68
+ it "raises if no invoice is passed" do
69
+ expect {
70
+ @client.update_invoice(nil)
71
+ }.to raise_error(ArgumentError)
72
+ end
73
+
74
+ it "raises if the simplified invoice to update has no id" do
75
+ stub_put("/invoices/.xml").
76
+ to_return(xml_response("ok.xml"))
77
+ expect {
78
+ @client.update_invoice(Invoicexpress::Models::SimplifiedInvoice.new)
79
+ }.to raise_error(ArgumentError)
80
+ end
81
+ end
82
+
83
+ describe ".update_invoice_state" do
84
+ it "updates the state" do
85
+ stub_put("/invoices/1503698/change-state.xml").
86
+ to_return(xml_response("invoices.update_state.xml"))
87
+
88
+ state = Invoicexpress::Models::InvoiceState.new(
89
+ :state => "finalized"
90
+ )
91
+ expect { @client.update_invoice_state(1503698, state) }.to_not raise_error
92
+ end
93
+ end
94
+
95
+ describe ".invoice_mail" do
96
+ it "sends the invoice through email" do
97
+ stub_put("/invoices/1503698/email-invoice.xml").
98
+ to_return(xml_response("ok.xml"))
99
+ message = Invoicexpress::Models::Message.new(
100
+ :subject => "Hello world",
101
+ :body => "Here is the invoice.",
102
+ :client => Invoicexpress::Models::Client.new(
103
+ :name => "Pedro Sousa",
104
+ :email=> 'info@thinkorange.pt'
105
+ )
106
+ )
107
+ expect { @client.invoice_mail(1503698, message) }.to_not raise_error
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,116 @@
1
+ require 'helper'
2
+
3
+ describe Invoicexpress::Client::PurchaseOrders do
4
+ before do
5
+ @client = Invoicexpress::Client.new(:screen_name => "thinkorangeteste")
6
+ end
7
+
8
+ describe ".purchase_orders" do
9
+ it "Returns all the purchase orders" do
10
+ stub_get("/purchase_orders.xml?page=1").
11
+ to_return(xml_response("po.list.xml"))
12
+
13
+ items = @client.purchase_orders
14
+ items.count.should == 1
15
+ items.first.id == 1430276
16
+ end
17
+ end
18
+
19
+ describe ".create_purchase_order" do
20
+ it "creates a new purchase order" do
21
+ stub_post("/purchase_orders.xml").
22
+ to_return(xml_response("po.create.xml"))
23
+
24
+ object = Invoicexpress::Models::PurchaseOrder.new(
25
+ :date => Date.new(2013, 5, 30),
26
+ :due_date => Date.new(2013, 8, 8),
27
+ :loaded_at => Date.new(2013, 5, 30),
28
+ :delivery_site=>'LX Factory',
29
+ :supplier => Invoicexpress::Models::Supplier.new(
30
+ :name => "Pedro Sousa",
31
+ ),
32
+ :items => [
33
+ Invoicexpress::Models::Item.new(
34
+ :name => "Item 1",
35
+ :unit_price => 60,
36
+ :quantity => 2,
37
+ :unit => "unit",
38
+ :tax=> Invoicexpress::Models::Tax.new(
39
+ :name=>'IVA23'
40
+ )
41
+ )
42
+ ]
43
+ )
44
+
45
+ item = @client.create_purchase_order(object)
46
+ item.id.should == 1430276
47
+ item.delivery_site.should == "LX Factory"
48
+ end
49
+ end
50
+
51
+ describe ".purchase_order" do
52
+ it "gets a purchase order" do
53
+ stub_get("/purchase_orders/1430276.xml").
54
+ to_return(xml_response("po.get.xml"))
55
+
56
+ item = @client.purchase_order(1430276)
57
+ item.status.should == "draft"
58
+ item.delivery_site.should == "LX Factory"
59
+ end
60
+ end
61
+
62
+ describe ".update_purchase_order" do
63
+ it "updates the purchase order" do
64
+ stub_put("/purchase_orders/1430276.xml").
65
+ to_return(xml_response("clients.update.xml"))
66
+
67
+ model = Invoicexpress::Models::PurchaseOrder.new(:id => 1430276)
68
+ expect { @client.update_purchase_order(model) }.to_not raise_error
69
+ end
70
+
71
+ it "raises if no purchase is passed" do
72
+ expect {
73
+ @client.update_purchase_order(nil)
74
+ }.to raise_error(ArgumentError)
75
+ end
76
+
77
+ it "raises if the purchase order update has no id" do
78
+ stub_put("/purchase_orders/.xml").
79
+ to_return(xml_response("ok.xml"))
80
+ expect {
81
+ @client.update_purchase_order(Invoicexpress::Models::PurchaseOrder.new)
82
+ }.to raise_error(ArgumentError)
83
+ end
84
+ end
85
+
86
+
87
+ describe ".update_purchase_order_state" do
88
+ it "updates the state" do
89
+ stub_put("/purchase_orders/1430338/change-state.xml").
90
+ to_return(xml_response("po.update_state.xml"))
91
+
92
+ state = Invoicexpress::Models::InvoiceState.new(
93
+ :state => "finalized"
94
+ )
95
+
96
+ expect { item = @client.update_purchase_order_state(1430338, state) }.to_not raise_error
97
+ end
98
+ end
99
+
100
+ describe ".simplified_invoice_mail" do
101
+ it "sends the invoice through email" do
102
+ stub_put("/purchase_orders/1430338/email-document.xml").
103
+ to_return(xml_response("po.email_document.xml"))
104
+
105
+ message = Invoicexpress::Models::Message.new(
106
+ :subject => "Hello world",
107
+ :body => "Here is the invoice.",
108
+ :client => Invoicexpress::Models::Client.new(
109
+ :name => "Pedro Sousa",
110
+ :email=> 'psousa@thinkorange.pt'
111
+ )
112
+ )
113
+ expect {item = @client.purchase_order_mail(1430338, message) }.to_not raise_error
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,111 @@
1
+ require 'helper'
2
+
3
+ describe Invoicexpress::Client::Schedules do
4
+ before do
5
+ @client = Invoicexpress::Client.new(:screen_name => "thinkorangeteste")
6
+ end
7
+
8
+ describe ".schedules" do
9
+ it "Returns all the schedules" do
10
+ stub_get("/schedules.xml").
11
+ to_return(xml_response("schedules.list.xml"))
12
+
13
+ list = @client.schedules
14
+ list.count.should == 1
15
+ list.first.client.id==439232
16
+ list.first.items.size==1
17
+ end
18
+ end
19
+
20
+ describe ".schedule" do
21
+ it "gets a schedule" do
22
+ stub_get("/schedules/4462.xml").
23
+ to_return(xml_response("schedules.get.xml"))
24
+
25
+ c = @client.schedule(4462)
26
+ c.id.should == 4462
27
+ c.sum.should == 360.0
28
+ end
29
+ end
30
+
31
+ describe ".update_schedule" do
32
+ it "updates the schedule" do
33
+ stub_put("/schedules/4462.xml").
34
+ to_return(xml_response("ok.xml"))
35
+
36
+ model = Invoicexpress::Models::Schedule.new(
37
+ :id=>4462,
38
+ :start_date => Date.new(2013, 6, 16),
39
+ :end_date => Date.new(2013, 8, 18),
40
+ :create_back => "Yes",
41
+ :schedule_type => "Monthly",
42
+ :interval => 2,
43
+ :send_to_client => "No",
44
+ :description=> "created from API.",
45
+ :invoice_template=> Invoicexpress::Models::InvoiceTemplate.new(
46
+ :due_days=>1,
47
+ :client => Invoicexpress::Models::Client.new(
48
+ :name => "Chuck Norris",
49
+ :email=>'chuck@thinkorange.pt'
50
+ ),
51
+ :items => [
52
+ Invoicexpress::Models::Item.new(
53
+ :name => "Item 1",
54
+ :unit_price => 30,
55
+ :quantity => 2,
56
+ :unit => "unit",
57
+ :tax=>Invoicexpress::Models::Tax.new(
58
+ :name => "IVA23",
59
+ )
60
+ ),
61
+ Invoicexpress::Models::Item.new(
62
+ :name => "Item 2",
63
+ :unit_price => 60,
64
+ :quantity => 5,
65
+ :unit => "unit",
66
+ :tax=>Invoicexpress::Models::Tax.new(
67
+ :name => "IVA23",
68
+ )
69
+ )
70
+ ]
71
+ )
72
+ )
73
+
74
+ expect { @client.update_schedule(model) }.to_not raise_error
75
+ end
76
+
77
+ it "raises if no schedule is passed" do
78
+ expect {
79
+ @client.update_schedule(nil)
80
+ }.to raise_error(ArgumentError)
81
+ end
82
+
83
+ it "raises if the schedule to update has no id" do
84
+ stub_put("/schedules/.xml").
85
+ to_return(xml_response("ok.xml"))
86
+ expect {
87
+ @client.update_schedule(Invoicexpress::Models::Schedule.new)
88
+ }.to raise_error(ArgumentError)
89
+ end
90
+ end
91
+
92
+ describe ".activate_schedule" do
93
+ it "activates the schedule" do
94
+ stub_put("/schedules/4462/activate").
95
+ to_return(xml_response("ok.xml"))
96
+ model = Invoicexpress::Models::Schedule.new(:id=>4462)
97
+ expect { item = @client.activate_schedule(model) }.to_not raise_error
98
+ end
99
+ end
100
+
101
+ describe ".deactivate_schedule" do
102
+ it "deactivates the schedule" do
103
+ stub_put("/schedules/4462/deactivate").
104
+ to_return(xml_response("ok.xml"))
105
+ model = Invoicexpress::Models::Schedule.new(:id=>4462)
106
+ expect { item = @client.deactivate_schedule(model) }.to_not raise_error
107
+ end
108
+ end
109
+
110
+ end
111
+
@@ -0,0 +1,68 @@
1
+ require 'helper'
2
+
3
+ describe Invoicexpress::Client::Sequences do
4
+ before do
5
+ @client = Invoicexpress::Client.new(:screen_name => "thinkorangeteste")
6
+ end
7
+
8
+ describe ".sequences" do
9
+ it "Returns all the sequences" do
10
+ stub_get("/sequences.xml").
11
+ to_return(xml_response("sequences.list.xml"))
12
+
13
+ list = @client.sequences
14
+ list.count.should == 1
15
+ list.first.id == 230568
16
+ list.first.current_invoice_number==1
17
+ end
18
+ end
19
+
20
+ describe ".sequence" do
21
+ it "gets a sequence" do
22
+ stub_get("/sequences/230568.xml").
23
+ to_return(xml_response("sequences.get.xml"))
24
+
25
+ c = @client.sequence(230568)
26
+ c.id.should == "230568"
27
+ c.serie.should == "2013"
28
+ end
29
+ end
30
+
31
+ describe ".create_sequence" do
32
+ it "creates a new sequence" do
33
+ stub_post("/sequences.xml").
34
+ to_return(xml_response("sequences.create.xml"))
35
+
36
+ seq = Invoicexpress::Models::Sequence.new({
37
+ :serie => "2099",
38
+ :current_invoice_number => 100,
39
+ :current_credit_note_number => 200,
40
+ :current_debit_note_number => 300,
41
+ :default_sequence => 0
42
+ })
43
+
44
+ new_object = @client.create_sequence(seq)
45
+ new_object.serie.should == "2099"
46
+ new_object.current_invoice_number.should == 100
47
+ end
48
+ end
49
+
50
+ describe ".update_sequence" do
51
+ it "updates the sequence" do
52
+ stub_put("/sequences/266500.xml").
53
+ to_return(xml_response("sequences.update.xml"))
54
+
55
+ model = Invoicexpress::Models::Sequence.new({
56
+ :id=>'266500',
57
+ :serie => "2098",
58
+ :current_invoice_number => 100,
59
+ :current_credit_note_number => 200,
60
+ :current_debit_note_number => 300,
61
+ :default_sequence => 0
62
+ })
63
+
64
+ expect { @client.update_sequence(model) }.to_not raise_error
65
+ end
66
+ end
67
+ end
68
+
@@ -0,0 +1,116 @@
1
+ require 'helper'
2
+
3
+ describe Invoicexpress::Client::SimplifiedInvoices do
4
+ before do
5
+ @client = Invoicexpress::Client.new(:screen_name => "thinkorangeteste")
6
+ end
7
+
8
+ describe ".simplified_invoices" do
9
+ it "Returns all the simplified invoices" do
10
+ stub_get("/simplified_invoices.xml?page=1").
11
+ to_return(xml_response("simplified_invoices.list.xml"))
12
+
13
+ items = @client.simplified_invoices
14
+ items.count.should == 2
15
+ items.first.id == 1425061
16
+ end
17
+ end
18
+
19
+ describe ".create_simplified_invoice" do
20
+ it "creates a new simplified invoice" do
21
+ stub_post("/simplified_invoices.xml").
22
+ to_return(xml_response("simplified_invoices.create.xml"))
23
+
24
+
25
+ object = Invoicexpress::Models::SimplifiedInvoice.new(
26
+ :date => Date.new(2013, 5, 1),
27
+ :due_date => Date.new(2013, 6, 1),
28
+ :tax_exemption => "M01",
29
+ :client => Invoicexpress::Models::Client.new(
30
+ :name => "Pedro Sousa"
31
+ ),
32
+ :items => [
33
+ Invoicexpress::Models::Item.new(
34
+ :name => "Item 1",
35
+ :unit_price => 60,
36
+ :quantity => 2,
37
+ :unit => "unit",
38
+ ),
39
+ Invoicexpress::Models::Item.new(
40
+ :name => "Item 2",
41
+ :unit_price => 50,
42
+ :quantity => 1,
43
+ :unit => "unit",
44
+ )
45
+ ]
46
+ )
47
+
48
+ item = @client.create_simplified_invoice(object)
49
+ item.id.should == 1425061
50
+ item.status == "draft"
51
+ end
52
+ end
53
+
54
+ describe ".simplified_invoice" do
55
+ it "gets a simplified invoice" do
56
+ stub_get("/simplified_invoices/1425061.xml").
57
+ to_return(xml_response("simplified_invoices.get.xml"))
58
+
59
+ item = @client.simplified_invoice(1425061)
60
+ item.status.should == "settled"
61
+ item.sequence_number.should == "1/2013"
62
+ end
63
+ end
64
+
65
+ describe ".update_simplified_invoice" do
66
+ it "updates the simplified invoice" do
67
+ stub_put("/simplified_invoices/1425061.xml").
68
+ to_return(xml_response("clients.update.xml"))
69
+
70
+ model = Invoicexpress::Models::SimplifiedInvoice.new(:id => 1425061)
71
+ expect { @client.update_simplified_invoice(model) }.to_not raise_error
72
+ end
73
+ it "raises if no simplified invoice is passed" do
74
+ expect {
75
+ @client.update_simplified_invoice(nil)
76
+ }.to raise_error(ArgumentError)
77
+ end
78
+
79
+ it "raises if the simplified invoice to update has no id" do
80
+ stub_put("/schedules/.xml").
81
+ to_return(xml_response("ok.xml"))
82
+ expect {
83
+ @client.update_simplified_invoice(Invoicexpress::Models::SimplifiedInvoice.new)
84
+ }.to raise_error(ArgumentError)
85
+ end
86
+ end
87
+
88
+ describe ".update_simplified_invoice_state" do
89
+ it "updates the state" do
90
+ stub_put("/simplified_invoices/1425061/change-state.xml").
91
+ to_return(xml_response("simplified_invoices.update_state.xml"))
92
+
93
+ state = Invoicexpress::Models::InvoiceState.new(
94
+ :state => "finalized"
95
+ )
96
+ expect { item = @client.update_simplified_invoice_state(1425061, state) }.to_not raise_error
97
+ end
98
+ end
99
+
100
+ describe ".simplified_invoice_mail" do
101
+ it "sends the invoice through email" do
102
+ stub_put("/simplified_invoices/1425061/email-document.xml").
103
+ to_return(xml_response("simplified_invoices.email_document.xml"))
104
+
105
+ message = Invoicexpress::Models::Message.new(
106
+ :subject => "Hello world",
107
+ :body => "Here is the invoice.",
108
+ :client => Invoicexpress::Models::Client.new(
109
+ :name => "Pedro Sousa",
110
+ :email=> 'psousa@thinkorange.pt'
111
+ )
112
+ )
113
+ expect {item = @client.simplified_invoice_mail(1425061, message) }.to_not raise_error
114
+ end
115
+ end
116
+ end