invoicexpress 0.1.9 → 0.1.9.1
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/CHANGELOG.md +4 -1
- data/README.md +2 -2
- data/lib/invoicexpress/models/invoice.rb +5 -6
- data/lib/invoicexpress/version.rb +1 -1
- data/spec/invoicexpress/client/invoices_spec.rb +40 -0
- metadata +18 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8003b0b4a237e72023cde65eeeaeaaf5cf68b4c
|
4
|
+
data.tar.gz: d7eac11d2c83f347e9e124b43076e87bfe4ce87e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 255398a4ab27004e35d3a59750627140b8cdf424fb71aaf020801b6e868c3a61121ec36b6d45ef8f2f6742cb2838e79a0a043c823e50b8209b35b5c96b6507b0
|
7
|
+
data.tar.gz: 826e7d7c7cdaeb91c8b20dfb4a222052f731219fc302be9f8a212856473484f84937da3f7a4f4e48072addffcfefd12c171eff63481f0e55a6e8f8da6e12d58e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# InvoiceXpress GEM
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/invoicexpress) [](https://travis-ci.org/weareswat/invoicexpress-gem) [](https://codeclimate.com/github/weareswat/invoicexpress-gem)
|
4
4
|
|
5
5
|
Gem for invoicexpress API at http://invoicexpress.com
|
6
|
-
Created with Reference:
|
6
|
+
Created with Reference: https://invoicexpress.com/api/overview
|
7
7
|
|
8
8
|
## Dependencies
|
9
9
|
|
@@ -44,7 +44,7 @@ module Invoicexpress
|
|
44
44
|
base.class_eval do
|
45
45
|
include HappyMapper
|
46
46
|
element :id, Integer
|
47
|
-
element :date, Date, :on_save => DATE_FORMAT
|
47
|
+
element :date, Date, :on_save => DATE_FORMAT
|
48
48
|
element :due_date, Date, :on_save => DATE_FORMAT
|
49
49
|
element :reference, String
|
50
50
|
element :observations, String
|
@@ -76,11 +76,10 @@ module Invoicexpress
|
|
76
76
|
element :before_taxes, Float
|
77
77
|
element :taxes, Float
|
78
78
|
element :total, Float
|
79
|
-
element :mb_reference, Integer
|
80
79
|
element :permalink, String
|
81
80
|
end
|
82
81
|
end
|
83
|
-
|
82
|
+
|
84
83
|
def to_core()
|
85
84
|
fields={:date => self.date,
|
86
85
|
:due_date => self.due_date,
|
@@ -101,12 +100,12 @@ module Invoicexpress
|
|
101
100
|
invoice = Invoicexpress::Models::CoreCreditNote.new(fields)
|
102
101
|
when "Invoicexpress::Models::DebitNote"
|
103
102
|
invoice = Invoicexpress::Models::CoreDebitNote.new(fields)
|
104
|
-
else
|
103
|
+
else
|
105
104
|
invoice = Invoicexpress::Models::CoreInvoice.new(fields)
|
106
105
|
end
|
107
106
|
end
|
108
107
|
end
|
109
|
-
|
108
|
+
|
110
109
|
# Note: we need all of these models because the API crashes when we send an object with the fields from the get request.
|
111
110
|
# example: do a get and then a update.
|
112
111
|
class CoreSimplifiedInvoice < BaseModel
|
@@ -139,7 +138,7 @@ module Invoicexpress
|
|
139
138
|
include ExtraInvoice
|
140
139
|
tag 'simplified_invoice'
|
141
140
|
end
|
142
|
-
|
141
|
+
|
143
142
|
class Invoice < BaseModel
|
144
143
|
include BaseInvoice
|
145
144
|
include ExtraInvoice
|
@@ -43,6 +43,46 @@ describe Invoicexpress::Client::Invoices do
|
|
43
43
|
item.id.should == 1503698
|
44
44
|
item.status == "draft"
|
45
45
|
end
|
46
|
+
|
47
|
+
context 'given an invoice with mb_reference set to true' do
|
48
|
+
let (:invoice) do
|
49
|
+
Invoicexpress::Models::Invoice.new(
|
50
|
+
:date => Date.new(2013, 6, 18),
|
51
|
+
:due_date => Date.new(2013, 6, 18),
|
52
|
+
:tax_exemption => "M01",
|
53
|
+
:mb_reference => true,
|
54
|
+
:client => Invoicexpress::Models::Client.new(
|
55
|
+
:name => "Ruben Fonseca"
|
56
|
+
),
|
57
|
+
:items => [
|
58
|
+
Invoicexpress::Models::Item.new(
|
59
|
+
:name => "Item 1",
|
60
|
+
:unit_price => 30,
|
61
|
+
:quantity => 1,
|
62
|
+
:unit => "unit",
|
63
|
+
)
|
64
|
+
]
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
before do
|
69
|
+
stub_post("/invoices.xml").
|
70
|
+
to_return(xml_response("invoices.create.xml"))
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'creates a draft invoice' do
|
74
|
+
item = @client.create_invoice(invoice)
|
75
|
+
item.id.should == 1503698
|
76
|
+
item.status == "draft"
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'sends mb_reference only once in the payload' do
|
80
|
+
@client.create_invoice(invoice)
|
81
|
+
expect(a_request(:post, /.+invoices.xml$/).with do |req|
|
82
|
+
req.body.scan(/<mb_reference>true<\/mb_reference>/).length == 1
|
83
|
+
end).to have_been_made.once
|
84
|
+
end
|
85
|
+
end
|
46
86
|
end
|
47
87
|
|
48
88
|
describe ".invoice" do
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoicexpress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.9
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.9.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Think Orange
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: faraday
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0.8'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0.8'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: faraday_middleware
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0.9'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0.9'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: happymapper
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0.4'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0.4'
|
78
69
|
description: Simple wrapper for invoicexpress.com API
|
@@ -88,7 +79,9 @@ files:
|
|
88
79
|
- invoicexpress.gemspec
|
89
80
|
- lib/faraday/response/parse_xml.rb
|
90
81
|
- lib/faraday/response/raise_invoicexpress_errors.rb
|
82
|
+
- lib/invoicexpress.rb
|
91
83
|
- lib/invoicexpress/authentication.rb
|
84
|
+
- lib/invoicexpress/client.rb
|
92
85
|
- lib/invoicexpress/client/cash_invoices.rb
|
93
86
|
- lib/invoicexpress/client/charts.rb
|
94
87
|
- lib/invoicexpress/client/clients.rb
|
@@ -102,10 +95,10 @@ files:
|
|
102
95
|
- lib/invoicexpress/client/simplified_invoices.rb
|
103
96
|
- lib/invoicexpress/client/taxes.rb
|
104
97
|
- lib/invoicexpress/client/users.rb
|
105
|
-
- lib/invoicexpress/client.rb
|
106
98
|
- lib/invoicexpress/configuration.rb
|
107
99
|
- lib/invoicexpress/connection.rb
|
108
100
|
- lib/invoicexpress/error.rb
|
101
|
+
- lib/invoicexpress/models.rb
|
109
102
|
- lib/invoicexpress/models/chart.rb
|
110
103
|
- lib/invoicexpress/models/client.rb
|
111
104
|
- lib/invoicexpress/models/filter.rb
|
@@ -118,10 +111,8 @@ files:
|
|
118
111
|
- lib/invoicexpress/models/top_client.rb
|
119
112
|
- lib/invoicexpress/models/top_debtor.rb
|
120
113
|
- lib/invoicexpress/models/user.rb
|
121
|
-
- lib/invoicexpress/models.rb
|
122
114
|
- lib/invoicexpress/request.rb
|
123
115
|
- lib/invoicexpress/version.rb
|
124
|
-
- lib/invoicexpress.rb
|
125
116
|
- spec/fixtures/charts.invoicing.xml
|
126
117
|
- spec/fixtures/charts.quarterly-results.xml
|
127
118
|
- spec/fixtures/charts.top-clients.xml
|
@@ -184,27 +175,26 @@ files:
|
|
184
175
|
homepage: http://invoicexpress.com
|
185
176
|
licenses:
|
186
177
|
- MIT
|
178
|
+
metadata: {}
|
187
179
|
post_install_message:
|
188
180
|
rdoc_options: []
|
189
181
|
require_paths:
|
190
182
|
- lib
|
191
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
-
none: false
|
193
184
|
requirements:
|
194
|
-
- -
|
185
|
+
- - ">="
|
195
186
|
- !ruby/object:Gem::Version
|
196
187
|
version: '0'
|
197
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
-
none: false
|
199
189
|
requirements:
|
200
|
-
- -
|
190
|
+
- - ">="
|
201
191
|
- !ruby/object:Gem::Version
|
202
192
|
version: 1.3.6
|
203
193
|
requirements: []
|
204
194
|
rubyforge_project:
|
205
|
-
rubygems_version:
|
195
|
+
rubygems_version: 2.4.6
|
206
196
|
signing_key:
|
207
|
-
specification_version:
|
197
|
+
specification_version: 4
|
208
198
|
summary: Simple wrapper for invoicexpress.com API
|
209
199
|
test_files:
|
210
200
|
- spec/fixtures/charts.invoicing.xml
|