invoicexpress 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +0 -0
- data/README.md +322 -0
- data/Rakefile +19 -0
- data/invoicexpress.gemspec +26 -0
- data/lib/faraday/response/parse_xml.rb +23 -0
- data/lib/faraday/response/raise_invoicexpress_errors.rb +20 -0
- data/lib/invoicexpress.rb +26 -0
- data/lib/invoicexpress/authentication.rb +15 -0
- data/lib/invoicexpress/client.rb +56 -0
- data/lib/invoicexpress/client/cash_invoices.rb +110 -0
- data/lib/invoicexpress/client/charts.rb +57 -0
- data/lib/invoicexpress/client/clients.rb +215 -0
- data/lib/invoicexpress/client/credit_notes.rb +128 -0
- data/lib/invoicexpress/client/debit_notes.rb +129 -0
- data/lib/invoicexpress/client/invoices.rb +107 -0
- data/lib/invoicexpress/client/items.rb +82 -0
- data/lib/invoicexpress/client/purchase_orders.rb +126 -0
- data/lib/invoicexpress/client/schedules.rb +110 -0
- data/lib/invoicexpress/client/sequences.rb +71 -0
- data/lib/invoicexpress/client/simplified_invoices.rb +130 -0
- data/lib/invoicexpress/client/taxes.rb +82 -0
- data/lib/invoicexpress/client/users.rb +48 -0
- data/lib/invoicexpress/configuration.rb +51 -0
- data/lib/invoicexpress/connection.rb +40 -0
- data/lib/invoicexpress/error.rb +68 -0
- data/lib/invoicexpress/models.rb +29 -0
- data/lib/invoicexpress/models/chart.rb +41 -0
- data/lib/invoicexpress/models/client.rb +24 -0
- data/lib/invoicexpress/models/filter.rb +60 -0
- data/lib/invoicexpress/models/invoice.rb +235 -0
- data/lib/invoicexpress/models/purchase_order.rb +72 -0
- data/lib/invoicexpress/models/quarterly_result.rb +45 -0
- data/lib/invoicexpress/models/schedule.rb +87 -0
- data/lib/invoicexpress/models/sequence.rb +17 -0
- data/lib/invoicexpress/models/supplier.rb +17 -0
- data/lib/invoicexpress/models/top_client.rb +15 -0
- data/lib/invoicexpress/models/top_debtor.rb +14 -0
- data/lib/invoicexpress/models/user.rb +31 -0
- data/lib/invoicexpress/request.rb +63 -0
- data/lib/invoicexpress/version.rb +3 -0
- data/spec/fixtures/charts.invoicing.xml +21 -0
- data/spec/fixtures/charts.quarterly-results.xml +25 -0
- data/spec/fixtures/charts.top-clients.xml +10 -0
- data/spec/fixtures/charts.top-debtors.xml +10 -0
- data/spec/fixtures/charts.treasury.xml +49 -0
- data/spec/fixtures/clients.create.xml +6 -0
- data/spec/fixtures/clients.get.xml +21 -0
- data/spec/fixtures/clients.invoices.xml +11 -0
- data/spec/fixtures/clients.list.xml +18 -0
- data/spec/fixtures/clients.update.xml +1 -0
- data/spec/fixtures/credit_notes.create.xml +53 -0
- data/spec/fixtures/credit_notes.email_document.xml +9 -0
- data/spec/fixtures/credit_notes.list.xml +114 -0
- data/spec/fixtures/credit_notes.update_state.xml +7 -0
- data/spec/fixtures/invoices.create.xml +37 -0
- data/spec/fixtures/invoices.get.xml +50 -0
- data/spec/fixtures/invoices.list.xml +537 -0
- data/spec/fixtures/invoices.update_state.xml +7 -0
- data/spec/fixtures/ok.xml +0 -0
- data/spec/fixtures/po.create.xml +42 -0
- data/spec/fixtures/po.email_document.xml +0 -0
- data/spec/fixtures/po.get.xml +42 -0
- data/spec/fixtures/po.list.xml +44 -0
- data/spec/fixtures/po.update_state.xml +7 -0
- data/spec/fixtures/schedules.create.xml +48 -0
- data/spec/fixtures/schedules.get.xml +57 -0
- data/spec/fixtures/schedules.list.xml +40 -0
- data/spec/fixtures/sequences.create.xml +9 -0
- data/spec/fixtures/sequences.get.xml +10 -0
- data/spec/fixtures/sequences.list.xml +12 -0
- data/spec/fixtures/sequences.update.xml +10 -0
- data/spec/fixtures/simplified_invoices.create.xml +53 -0
- data/spec/fixtures/simplified_invoices.email_document.xml +9 -0
- data/spec/fixtures/simplified_invoices.get.xml +74 -0
- data/spec/fixtures/simplified_invoices.list.xml +114 -0
- data/spec/fixtures/simplified_invoices.update.xml +0 -0
- data/spec/fixtures/simplified_invoices.update_state.xml +7 -0
- data/spec/fixtures/taxes.create.xml +7 -0
- data/spec/fixtures/taxes.list.xml +18 -0
- data/spec/fixtures/taxes.update.xml +7 -0
- data/spec/fixtures/users.accounts.xml +12 -0
- data/spec/fixtures/users.change-account.xml +0 -0
- data/spec/fixtures/users.login.xml +11 -0
- data/spec/helper.rb +62 -0
- data/spec/invoicexpress/client/charts_spec.rb +69 -0
- data/spec/invoicexpress/client/clients_spec.rb +108 -0
- data/spec/invoicexpress/client/credit_notes_spec.rb +104 -0
- data/spec/invoicexpress/client/invoices_spec.rb +110 -0
- data/spec/invoicexpress/client/purchase_orders_spec.rb +116 -0
- data/spec/invoicexpress/client/schedules_spec.rb +111 -0
- data/spec/invoicexpress/client/sequences_spec.rb +68 -0
- data/spec/invoicexpress/client/simplified_invoices_spec.rb +116 -0
- data/spec/invoicexpress/client/taxes_spec.rb +70 -0
- data/spec/invoicexpress/client/users_spec.rb +40 -0
- data/spec/invoicexpress/client_spec.rb +24 -0
- data/spec/invoicexpress_spec.rb +19 -0
- metadata +279 -0
data/CHANGELOG.md
ADDED
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,322 @@
|
|
1
|
+
# invoiceXpress GEM
|
2
|
+
|
3
|
+
Gem for invoicexpress API
|
4
|
+
Reference: http://en.invoicexpress.com/api/overview/introduction/
|
5
|
+
|
6
|
+
## Dependencies
|
7
|
+
|
8
|
+
Run bundle, the project should need:
|
9
|
+
Happymapper
|
10
|
+
Faraday
|
11
|
+
And pretzels!
|
12
|
+
|
13
|
+
## Progress
|
14
|
+
|
15
|
+
* Client - 100%
|
16
|
+
* Sequences - 100%
|
17
|
+
* Users - 100%
|
18
|
+
* Invoices - 100%
|
19
|
+
* Cash Invoices - 100%
|
20
|
+
* Items - 100%
|
21
|
+
* Charts - 100%
|
22
|
+
* Debit Notes - 100%
|
23
|
+
* Credit Notes - 100%
|
24
|
+
* Taxes - 100%
|
25
|
+
* Schedules - 100%
|
26
|
+
* Sim. Invoices - 100%
|
27
|
+
* Purch. Orders - 100%
|
28
|
+
|
29
|
+
## Tests
|
30
|
+
|
31
|
+
* Client - 100%
|
32
|
+
* Sequences - 100%
|
33
|
+
* Users - 100%
|
34
|
+
* Charts - 100%
|
35
|
+
* Taxes - 100%
|
36
|
+
* Schedules - 100%
|
37
|
+
* Invoices - 100%
|
38
|
+
* Sim. Invoices - 100%
|
39
|
+
* Credit Notes - 100%
|
40
|
+
* Purch. Orders - 100%
|
41
|
+
|
42
|
+
## Documentation
|
43
|
+
|
44
|
+
We've included docs for all methods. Refer to the doc folder and client section.
|
45
|
+
|
46
|
+
## Examples
|
47
|
+
|
48
|
+
If using from inside a rails project use:
|
49
|
+
require 'invoicexpress'
|
50
|
+
|
51
|
+
client = Invoicexpress::Client.new(
|
52
|
+
:screen_name => "yourusername",
|
53
|
+
:api_key => "yourapikey"
|
54
|
+
)
|
55
|
+
|
56
|
+
Here's some examples for the most common objects and endpoints. You could also take a look at the spec folder for extensive tests.
|
57
|
+
|
58
|
+
### Simplified Invoices
|
59
|
+
|
60
|
+
simple_invoices = @client.simplified_invoices
|
61
|
+
puts simple_invoices
|
62
|
+
|
63
|
+
invoice = Invoicexpress::Models::SimplifiedInvoice.new(
|
64
|
+
:date => Date.new(2013, 6, 16),
|
65
|
+
:due_date => Date.new(2013, 6, 16),
|
66
|
+
:tax_exemption => "M01",
|
67
|
+
:observations=> 'new',
|
68
|
+
:client => Invoicexpress::Models::Client.new(
|
69
|
+
:name => "Pedro Sousa",
|
70
|
+
:email=> 'psousa@thinkorange.pt'
|
71
|
+
),
|
72
|
+
:items => [
|
73
|
+
Invoicexpress::Models::Item.new(
|
74
|
+
:name => "Item 6",
|
75
|
+
:unit_price => 120,
|
76
|
+
:quantity => 2,
|
77
|
+
:unit => "unit",
|
78
|
+
),
|
79
|
+
Invoicexpress::Models::Item.new(
|
80
|
+
:name => "Item AM",
|
81
|
+
:unit_price => 50,
|
82
|
+
:quantity => 1,
|
83
|
+
:unit => "unit",
|
84
|
+
)
|
85
|
+
]
|
86
|
+
)
|
87
|
+
simple_invoice = @client.create_simplified_invoice(invoice)
|
88
|
+
simple_invoice = @client.simplified_invoice(1425061)
|
89
|
+
simple_invoice.tax_exemption="M02"
|
90
|
+
@client.update_simplified_invoice(simple_invoice)
|
91
|
+
state = Invoicexpress::Models::InvoiceState.new(
|
92
|
+
:state => "finalized"
|
93
|
+
)
|
94
|
+
@client.update_simplified_invoice_state(simple_invoice.id, state)
|
95
|
+
|
96
|
+
### Credit Notes
|
97
|
+
|
98
|
+
credit_notes = @client.credit_notes
|
99
|
+
puts credit_notes
|
100
|
+
|
101
|
+
cnote = Invoicexpress::Models::CreditNote.new(
|
102
|
+
:date => Date.new(2013, 6, 11),
|
103
|
+
:due_date => Date.new(2013, 6, 11),
|
104
|
+
:tax_exemption => "M01",
|
105
|
+
:client => Invoicexpress::Models::Client.new(
|
106
|
+
:name => "Pedro Sousa",
|
107
|
+
:email=> 'psousa@thinkorange.pt'
|
108
|
+
),
|
109
|
+
:items => [
|
110
|
+
Invoicexpress::Models::Item.new(
|
111
|
+
:name => "Item 1",
|
112
|
+
:unit_price => 60,
|
113
|
+
:quantity => 2,
|
114
|
+
:unit => "unit",
|
115
|
+
),
|
116
|
+
Invoicexpress::Models::Item.new(
|
117
|
+
:name => "Item 2",
|
118
|
+
:unit_price => 50,
|
119
|
+
:quantity => 1,
|
120
|
+
:unit => "unit",
|
121
|
+
)
|
122
|
+
]
|
123
|
+
)
|
124
|
+
cnote = @client.create_credit_note(cnote)
|
125
|
+
cnote_load = @client.credit_note(cnote.id)
|
126
|
+
cnote_load.tax_exemption="M02"
|
127
|
+
@client.update_credit_note(cnote_load)
|
128
|
+
state = Invoicexpress::Models::InvoiceState.new(
|
129
|
+
:state => "finalized"
|
130
|
+
)
|
131
|
+
@client.update_credit_note_state(cnote_load.id, state)
|
132
|
+
|
133
|
+
### Debit Notes
|
134
|
+
|
135
|
+
|
136
|
+
debit_notes = @client.debit_notes
|
137
|
+
puts debit_notes
|
138
|
+
|
139
|
+
dnote = Invoicexpress::Models::DebitNote.new(
|
140
|
+
:date => Date.new(2013, 5, 1),
|
141
|
+
:due_date => Date.new(2013, 6, 1),
|
142
|
+
:tax_exemption => "M01",
|
143
|
+
:client => Invoicexpress::Models::Client.new(
|
144
|
+
:name => "Pedro Sousa",
|
145
|
+
:email=> 'psousa@thinkorange.pt'
|
146
|
+
),
|
147
|
+
:items => [
|
148
|
+
Invoicexpress::Models::Item.new(
|
149
|
+
:name => "Item 1",
|
150
|
+
:unit_price => 60,
|
151
|
+
:quantity => 2,
|
152
|
+
:unit => "unit",
|
153
|
+
)
|
154
|
+
]
|
155
|
+
)
|
156
|
+
dnote = @client.create_debit_note(dnote)
|
157
|
+
dnote_loaded = @client.debit_note(1503654)
|
158
|
+
dnote.tax_exemption="M02"
|
159
|
+
@client.update_debit_note(dnote)
|
160
|
+
state = Invoicexpress::Models::InvoiceState.new(
|
161
|
+
:state => "finalized"
|
162
|
+
)
|
163
|
+
dnote = @client.update_credit_note_state(dnote.id, state)
|
164
|
+
|
165
|
+
### Invoices
|
166
|
+
|
167
|
+
invoices = @client.invoices
|
168
|
+
invoices.invoices.count
|
169
|
+
invoices.current_page
|
170
|
+
puts invoices
|
171
|
+
|
172
|
+
invoice = @client.invoice(1042320)
|
173
|
+
|
174
|
+
invoice = Invoicexpress::Models::Invoice.new(
|
175
|
+
:date => Date.new(2013, 6, 18),
|
176
|
+
:due_date => Date.new(2013, 6, 18),
|
177
|
+
:tax_exemption => "M01",
|
178
|
+
:client => Invoicexpress::Models::Client.new(
|
179
|
+
:name => "Ruben Fonseca"
|
180
|
+
),
|
181
|
+
:items => [
|
182
|
+
Invoicexpress::Models::Item.new(
|
183
|
+
:name => "Item 1",
|
184
|
+
:unit_price => 30,
|
185
|
+
:quantity => 1,
|
186
|
+
:unit => "unit",
|
187
|
+
)
|
188
|
+
]
|
189
|
+
)
|
190
|
+
invoice = @client.create_invoice(invoice)
|
191
|
+
|
192
|
+
invoice.observations="updated from api"
|
193
|
+
@client.update_invoice(invoice)
|
194
|
+
|
195
|
+
invoice_state = Invoicexpress::Models::InvoiceState.new(
|
196
|
+
:state => "finalized"
|
197
|
+
)
|
198
|
+
@client.update_invoice_state(invoice.id, invoice_state)
|
199
|
+
|
200
|
+
message = Invoicexpress::Models::Message.new(
|
201
|
+
:client => Invoicexpress::Models::Client.new(
|
202
|
+
:email => "info@thinkorange.pt",
|
203
|
+
:name=>"Chuck Norris"
|
204
|
+
),
|
205
|
+
:subject => "Your invoice",
|
206
|
+
:body => "Attached to this email"
|
207
|
+
)
|
208
|
+
@client.invoice_email(invoice.id, message)
|
209
|
+
|
210
|
+
### Charts
|
211
|
+
|
212
|
+
chart_i = @client.invoicing_chart
|
213
|
+
chart_t = @client.treasury_chart
|
214
|
+
top_c = @client.top_clients
|
215
|
+
top_d = @client.top_debtors
|
216
|
+
quarter = @client.quarterly_results(2011)
|
217
|
+
|
218
|
+
### Schedules
|
219
|
+
|
220
|
+
|
221
|
+
new_schedule = Invoicexpress::Models::Schedule.new(
|
222
|
+
:start_date => Date.new(2013, 6, 16),
|
223
|
+
:end_date => Date.new(2013, 8, 18),
|
224
|
+
:create_back => "Yes",
|
225
|
+
:schedule_type => "Monthly",
|
226
|
+
:interval => 2,
|
227
|
+
:send_to_client => "No",
|
228
|
+
:description=> "created from API.",
|
229
|
+
:invoice_template=> Invoicexpress::Models::InvoiceTemplate.new(
|
230
|
+
:due_days=>1,
|
231
|
+
:client => Invoicexpress::Models::Client.new(
|
232
|
+
:name => "Rui Leitão",
|
233
|
+
:email=>'rmleitao@thinkorange.pt'
|
234
|
+
),
|
235
|
+
:items => [
|
236
|
+
Invoicexpress::Models::Item.new(
|
237
|
+
:name => "Item 1",
|
238
|
+
:unit_price => 30,
|
239
|
+
:quantity => 2,
|
240
|
+
:unit => "unit",
|
241
|
+
:tax=>Invoicexpress::Models::Tax.new(
|
242
|
+
:name => "IVA23",
|
243
|
+
)
|
244
|
+
),
|
245
|
+
Invoicexpress::Models::Item.new(
|
246
|
+
:name => "Item 2",
|
247
|
+
:unit_price => 60,
|
248
|
+
:quantity => 5,
|
249
|
+
:unit => "unit",
|
250
|
+
:tax=>Invoicexpress::Models::Tax.new(
|
251
|
+
:name => "IVA23",
|
252
|
+
)
|
253
|
+
)
|
254
|
+
]
|
255
|
+
)
|
256
|
+
)
|
257
|
+
schedule = @client.create_schedule(new_schedule)
|
258
|
+
|
259
|
+
To update a schedule we need to pass these fields.
|
260
|
+
|
261
|
+
schedule.invoice_template=Invoicexpress::Models::InvoiceTemplate.new(
|
262
|
+
:due_days=>1,
|
263
|
+
:client => Invoicexpress::Models::Client.new(
|
264
|
+
:name => "Rui Leitão",
|
265
|
+
:email=>'rmleitao@thinkorange.pt'
|
266
|
+
),
|
267
|
+
:items => [
|
268
|
+
Invoicexpress::Models::Item.new(
|
269
|
+
:name => "Item 1",
|
270
|
+
:unit_price => 30,
|
271
|
+
:quantity => 2,
|
272
|
+
:unit => "unit",
|
273
|
+
:tax=>Invoicexpress::Models::Tax.new(
|
274
|
+
:name => "IVA23",
|
275
|
+
)
|
276
|
+
),
|
277
|
+
Invoicexpress::Models::Item.new(
|
278
|
+
:name => "Item 2",
|
279
|
+
:unit_price => 60,
|
280
|
+
:quantity => 5,
|
281
|
+
:unit => "unit",
|
282
|
+
:tax=>Invoicexpress::Models::Tax.new(
|
283
|
+
:name => "IVA23",
|
284
|
+
)
|
285
|
+
)
|
286
|
+
]
|
287
|
+
)
|
288
|
+
schedule.interval=2
|
289
|
+
schedule.schedule_type="Monthly"
|
290
|
+
schedule.send_to_client="No"
|
291
|
+
schedule.description="Maybe"
|
292
|
+
schedule.create_back="No"
|
293
|
+
@client.update_schedule(schedule)
|
294
|
+
|
295
|
+
@client.activate schedule
|
296
|
+
@client.deactivate_schedule schedule
|
297
|
+
|
298
|
+
### Purchase Orders
|
299
|
+
|
300
|
+
|
301
|
+
orders=@client.purchase_orders
|
302
|
+
purchase_order = Invoicexpress::Models::PurchaseOrder.new(
|
303
|
+
:date => Date.new(2013, 5, 30),
|
304
|
+
:due_date => Date.new(2013, 8, 8),
|
305
|
+
:loaded_at => Date.new(2013, 5, 30),
|
306
|
+
:delivery_site=>'LX',
|
307
|
+
:supplier => Invoicexpress::Models::Supplier.new(
|
308
|
+
:name => "Pedro Sousa",
|
309
|
+
),
|
310
|
+
:items => [
|
311
|
+
Invoicexpress::Models::Item.new(
|
312
|
+
:name => "Item 1",
|
313
|
+
:unit_price => 60,
|
314
|
+
:quantity => 2,
|
315
|
+
:unit => "unit",
|
316
|
+
:tax=> Invoicexpress::Models::Tax.new(
|
317
|
+
:name=>'IVA23'
|
318
|
+
)
|
319
|
+
)
|
320
|
+
]
|
321
|
+
)
|
322
|
+
purchase_order = @client.create_purchase_order(purchase_order)
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :test => :spec
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
namespace :doc do
|
11
|
+
require 'yard'
|
12
|
+
YARD::Rake::YardocTask.new do |task|
|
13
|
+
task.files = ['README.md', 'lib/**/*.rb']
|
14
|
+
task.options = [
|
15
|
+
'--output-dir', 'doc/yard',
|
16
|
+
'--markup', 'markdown'
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'invoicexpress/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
7
|
+
|
8
|
+
spec.add_dependency 'faraday', '~> 0.8'
|
9
|
+
spec.add_dependency 'faraday_middleware', '~> 0.9'
|
10
|
+
spec.add_dependency 'happymapper', '~> 0.4'
|
11
|
+
|
12
|
+
spec.authors = ["Think Orange"]
|
13
|
+
spec.description = %q{Simple wrapper for invoicexpress.com API}
|
14
|
+
spec.email = ['info@thinkorange.pt']
|
15
|
+
spec.files = %w(CHANGELOG.md README.md Rakefile invoicexpress.gemspec)
|
16
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
17
|
+
spec.files += Dir.glob("spec/**/*")
|
18
|
+
spec.homepage = "http://invoicexpress.pt"
|
19
|
+
spec.licenses = ['MIT']
|
20
|
+
spec.name = 'invoicexpress'
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
23
|
+
spec.summary = spec.description
|
24
|
+
spec.test_files = Dir.glob("spec/**/*")
|
25
|
+
spec.version = Invoicexpress::VERSION
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
# @api private
|
5
|
+
module Faraday
|
6
|
+
class Response::ParseXML < Response::Middleware
|
7
|
+
|
8
|
+
def initialize(app, klass)
|
9
|
+
@klass = klass
|
10
|
+
|
11
|
+
super(app)
|
12
|
+
end
|
13
|
+
|
14
|
+
def on_complete(env)
|
15
|
+
if env[:body] and !env[:body].strip.empty?
|
16
|
+
env[:body] = @klass.parse env[:body]
|
17
|
+
else
|
18
|
+
env[:body] = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
# @api private
|
4
|
+
module Faraday
|
5
|
+
class Response::RaiseInvoicexpressErrors < Response::Middleware
|
6
|
+
ERROR_MAP = {
|
7
|
+
401 => Invoicexpress::Unauthorized,
|
8
|
+
422 => Invoicexpress::UnprocessableEntity,
|
9
|
+
500 => Invoicexpress::InternalServerError,
|
10
|
+
}
|
11
|
+
|
12
|
+
def on_complete(env)
|
13
|
+
key = env[:status].to_i
|
14
|
+
|
15
|
+
if ERROR_MAP.has_key? key
|
16
|
+
raise ERROR_MAP[key].new(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'invoicexpress/configuration'
|
2
|
+
require 'invoicexpress/error'
|
3
|
+
require 'invoicexpress/client'
|
4
|
+
|
5
|
+
module Invoicexpress
|
6
|
+
extend Configuration
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Alias for Invoicexpress::Client.new
|
10
|
+
#
|
11
|
+
# @return [Invoicexpress::Client]
|
12
|
+
def new(options={})
|
13
|
+
Invoicexpress::Client.new(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Delegate to Octokit::Client.new
|
17
|
+
def method_missing(method, *args, &block)
|
18
|
+
return super unless new.respond_to?(method)
|
19
|
+
new.send(method, *args, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def respond_to?(method, include_private=false)
|
23
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|