collector-ruby 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.autotest +4 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +170 -0
- data/Rakefile +6 -0
- data/collector-ruby.gemspec +33 -0
- data/collector_browser.rb +93 -0
- data/lib/collector.rb +25 -0
- data/lib/collector/activate_invoice_request.rb +45 -0
- data/lib/collector/address.rb +28 -0
- data/lib/collector/adjust_invoice_request.rb +28 -0
- data/lib/collector/article_list_item.rb +28 -0
- data/lib/collector/base_model.rb +116 -0
- data/lib/collector/cancel_invoice_request.rb +22 -0
- data/lib/collector/client.rb +133 -0
- data/lib/collector/get_address_request.rb +22 -0
- data/lib/collector/invoice_request.rb +63 -0
- data/lib/collector/invoice_response.rb +27 -0
- data/lib/collector/invoice_row.rb +18 -0
- data/lib/collector/replace_invoice_request.rb +31 -0
- data/lib/collector/user.rb +25 -0
- data/lib/collector/version.rb +3 -0
- data/spec/address_spec.rb +45 -0
- data/spec/article_list_item_spec.rb +33 -0
- data/spec/base_model_spec.rb +42 -0
- data/spec/helpers/sandbox_objects_helper.rb +83 -0
- data/spec/invoice_request_spec.rb +27 -0
- data/spec/invoice_response_spec.rb +29 -0
- data/spec/invoice_row_spec.rb +29 -0
- data/spec/operations/activate_invoice_spec.rb +82 -0
- data/spec/operations/add_invoice_spec.rb +130 -0
- data/spec/operations/adjust_invoice_spec.rb +54 -0
- data/spec/operations/cancel_invoice_spec.rb +33 -0
- data/spec/operations/get_address_spec.rb +34 -0
- data/spec/operations/replace_invoice_spec.rb +45 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/user_spec.rb +40 -0
- data/usage_example.rb +39 -0
- metadata +253 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'nori' # Available through Savon
|
5
|
+
|
6
|
+
describe "Collector::Client#add_invoice" do
|
7
|
+
before :all do
|
8
|
+
@client = collector_client
|
9
|
+
end
|
10
|
+
it "performs an AddInvoice request" do
|
11
|
+
VCR.use_cassette('add_invoice') do
|
12
|
+
response = @client.add_invoice(sandbox_invoice_request)
|
13
|
+
response.should be_kind_of Collector::InvoiceResponse
|
14
|
+
response.invoice_no.should_not be_nil
|
15
|
+
response.invoice_status.should_not be_nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
context "with all optional fields set" do
|
19
|
+
it "performs an AddInvoice request" do
|
20
|
+
VCR.use_cassette('add_invoice_all_fields') do
|
21
|
+
response = @client.add_invoice(full_sandbox_invoice_request)
|
22
|
+
response.should be_kind_of Collector::InvoiceResponse
|
23
|
+
response.invoice_no.should_not be_nil
|
24
|
+
response.invoice_status.should_not be_nil
|
25
|
+
response.correlation_id.should eq "test corr id"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end # with all optional fields set
|
29
|
+
context "incomplete request" do
|
30
|
+
it "raises an exception" do
|
31
|
+
@incomplete_req = sandbox_invoice_request
|
32
|
+
@incomplete_req.activation_option = nil
|
33
|
+
@incomplete_req.store_id = nil
|
34
|
+
expect { @client.add_invoice(@incomplete_req)}.to raise_error ArgumentError
|
35
|
+
end
|
36
|
+
it "raises an exception when nested objects are incomplete" do
|
37
|
+
@incomplete_req = sandbox_invoice_request
|
38
|
+
@incomplete_req.delivery_address.address1 = nil
|
39
|
+
expect { @client.add_invoice(@incomplete_req)}.to raise_error ArgumentError
|
40
|
+
end
|
41
|
+
it "lists the missing attributes" do
|
42
|
+
@incomplete_req = sandbox_invoice_request
|
43
|
+
@incomplete_req.activation_option = nil
|
44
|
+
@incomplete_req.delivery_address.address1 = nil
|
45
|
+
@incomplete_req.invoice_rows.first.article_id = nil
|
46
|
+
begin
|
47
|
+
@client.add_invoice(@incomplete_req)
|
48
|
+
rescue => e
|
49
|
+
e.message.should eq "Missing attributes: activation_option, delivery_address.address1, invoice_rows[0].article_id"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end # incomplete request
|
53
|
+
context "with multiple rows" do
|
54
|
+
it "performs an AddInvoice request" do
|
55
|
+
VCR.use_cassette('add_invoice_multiple_rows') do
|
56
|
+
request = sandbox_invoice_request
|
57
|
+
request.invoice_rows << sandbox_invoice_row
|
58
|
+
request.invoice_rows << sandbox_invoice_row
|
59
|
+
response = @client.add_invoice(request)
|
60
|
+
response.should be_kind_of Collector::InvoiceResponse
|
61
|
+
response.invoice_no.should_not be_nil
|
62
|
+
response.invoice_status.should_not be_nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
context "SOAP query" do
|
67
|
+
before :all do
|
68
|
+
WebMock.after_request do |request_signature, response|
|
69
|
+
@req_headers = request_signature.headers
|
70
|
+
@req_body = request_signature.body
|
71
|
+
soap = Nori.new.parse(@req_body)
|
72
|
+
envelope = soap['env:Envelope']
|
73
|
+
@soap_header = envelope['env:Header']
|
74
|
+
@soap_body = envelope['env:Body']
|
75
|
+
@soap_request = @soap_body['lol0:AddInvoiceRequest']
|
76
|
+
end
|
77
|
+
VCR.use_cassette('add_invoice') do
|
78
|
+
@client.add_invoice(sandbox_invoice_request)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
after :all do
|
82
|
+
WebMock::CallbackRegistry.reset
|
83
|
+
end
|
84
|
+
it "sets the headers" do
|
85
|
+
@soap_header['lol0:Password'].should eq "blingo_test"
|
86
|
+
@soap_header['lol0:Username'].should eq "blingo_test"
|
87
|
+
# @soap_header['lol0:ClientIpAddress'].should eq
|
88
|
+
end
|
89
|
+
it "includes all parameters in request" do
|
90
|
+
@soap_request['lol0:ActivationOption'].should eq "0"
|
91
|
+
@soap_request['lol0:CountryCode'].should eq "SE"
|
92
|
+
@soap_request['lol0:Currency'].should eq "SEK"
|
93
|
+
@soap_request['lol0:InvoiceDeliveryMethod'].should eq "1"
|
94
|
+
@soap_request['lol0:InvoiceType'].should eq "0"
|
95
|
+
@soap_request['lol0:RegNo'].should eq "1602079954"
|
96
|
+
@soap_request['lol0:StoreId'].should eq "355"
|
97
|
+
@soap_request['lol0:OrderDate'].should be_kind_of DateTime
|
98
|
+
@soap_request['lol0:OrderDate'].to_time.to_f.should be_within(2).of(DateTime.now.to_time.to_f)
|
99
|
+
end
|
100
|
+
it "includes the DeliveryAddress" do
|
101
|
+
@address = @soap_request['lol0:DeliveryAddress']
|
102
|
+
@address['lol0:Address1'].should eq 'GATUADRESSAKT211'
|
103
|
+
@address['lol0:Address2'].should eq 'Not required'
|
104
|
+
@address['lol0:City'].should eq 'UMEÅ'
|
105
|
+
@address['lol0:CountryCode'].should eq 'SE'
|
106
|
+
@address['lol0:PostalCode'].should eq '90737'
|
107
|
+
@address['lol0:Firstname'].should eq 'FÖRNAMNAKT211'
|
108
|
+
@address['lol0:Lastname'].should eq 'EFTERNAMNAKT211'
|
109
|
+
end
|
110
|
+
it "includes the InvoiceAddress" do
|
111
|
+
@address = @soap_request['lol0:InvoiceAddress']
|
112
|
+
@address['lol0:Address1'].should eq 'GATUADRESSAKT211'
|
113
|
+
@address['lol0:Address2'].should eq 'Not required'
|
114
|
+
@address['lol0:City'].should eq 'UMEÅ'
|
115
|
+
@address['lol0:CountryCode'].should eq 'SE'
|
116
|
+
@address['lol0:PostalCode'].should eq '90737'
|
117
|
+
@address['lol0:Firstname'].should eq 'FÖRNAMNAKT211'
|
118
|
+
@address['lol0:Lastname'].should eq 'EFTERNAMNAKT211'
|
119
|
+
end
|
120
|
+
it "includes the InvoiceRows" do
|
121
|
+
@invoice_rows = @soap_request['lol0:InvoiceRows']
|
122
|
+
@invoice_row = @invoice_rows['lol0:InvoiceRow']
|
123
|
+
@invoice_row['lol0:ArticleId'].should eq '12'
|
124
|
+
@invoice_row['lol0:Description'].should eq 'A wonderful thing'
|
125
|
+
@invoice_row['lol0:Quantity'].should eq '2'
|
126
|
+
@invoice_row['lol0:UnitPrice'].should eq '12.0'
|
127
|
+
@invoice_row['lol0:VAT'].should eq '2.0'
|
128
|
+
end
|
129
|
+
end # SOAP query
|
130
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
describe "Collector::Client#adjust_invoice" do
|
5
|
+
before :each do
|
6
|
+
@client = collector_client
|
7
|
+
product = product2
|
8
|
+
@item = Collector::ArticleListItem.new(product)
|
9
|
+
end
|
10
|
+
def activate_invoice(invoice_no)
|
11
|
+
@client.activate_invoice(invoice_no: invoice_no,
|
12
|
+
store_id: "355",
|
13
|
+
country_code: "SE",
|
14
|
+
correlation_id: "testing_activate_invoice")
|
15
|
+
end
|
16
|
+
def adjust_invoice(invoice_no, item, amount, vat)
|
17
|
+
@client.adjust_invoice(invoice_no: invoice_no,
|
18
|
+
article_id: item.article_id,
|
19
|
+
description: "You are our 100th customer!",
|
20
|
+
amount: amount,
|
21
|
+
vat: vat,
|
22
|
+
store_id: "355",
|
23
|
+
country_code: "SE",
|
24
|
+
correlation_id: "testing_adjust_invoice")
|
25
|
+
end
|
26
|
+
it "performs an AdjustInvoice request" do
|
27
|
+
VCR.use_cassette('adjust_invoice') do
|
28
|
+
invoice_no = add_original_invoice
|
29
|
+
activate_invoice(invoice_no)
|
30
|
+
amount = "-2.50"
|
31
|
+
vat = "2.0"
|
32
|
+
correlation_id = adjust_invoice(invoice_no, @item, amount, vat)
|
33
|
+
correlation_id.should eq "testing_adjust_invoice"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
it "it allows adjusting back to the original amount" do
|
37
|
+
VCR.use_cassette('adjust_invoice_back') do
|
38
|
+
invoice_no = add_original_invoice
|
39
|
+
activate_invoice(invoice_no)
|
40
|
+
adjust_invoice(invoice_no, @item, "-2.50", "2.0")
|
41
|
+
adjust_invoice(invoice_no, @item, "-1.50", "2.0")
|
42
|
+
expect { adjust_invoice(invoice_no, @item, "4.00", "2.0") }.not_to raise_error
|
43
|
+
end
|
44
|
+
end
|
45
|
+
it "it does not allow adjusting back to more than the original amount" do
|
46
|
+
VCR.use_cassette('adjust_invoice_back_too_much') do
|
47
|
+
invoice_no = add_original_invoice
|
48
|
+
activate_invoice(invoice_no)
|
49
|
+
adjust_invoice(invoice_no, @item, "-2.50", "2.0")
|
50
|
+
adjust_invoice(invoice_no, @item, "-1.50", "2.0")
|
51
|
+
expect { adjust_invoice(invoice_no, @item, "4.50", "2.0") }.to raise_error Collector::InvalidTransactionAmountError
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
describe "Collector::Client#cancel_invoice" do
|
5
|
+
before :all do
|
6
|
+
@client = collector_client
|
7
|
+
end
|
8
|
+
def cancel_invoice(invoice_no)
|
9
|
+
@client.cancel_invoice(invoice_no: invoice_no,
|
10
|
+
store_id: "355",
|
11
|
+
country_code: "SE",
|
12
|
+
correlation_id: "test_cancel_invoice" )
|
13
|
+
|
14
|
+
end
|
15
|
+
it "performs a CancelInvoice request" do
|
16
|
+
VCR.use_cassette('cancel_invoice') do
|
17
|
+
@invoice_no = add_original_invoice
|
18
|
+
correlation_id = cancel_invoice(@invoice_no)
|
19
|
+
correlation_id.should eq "test_cancel_invoice"
|
20
|
+
expect { cancel_invoice(@invoice_no) }.to raise_error Collector::InvalidInvoiceStatusError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
it "causes the invoice to be impossible to activate" do
|
24
|
+
VCR.use_cassette('activate_canceled_invoice') do
|
25
|
+
@invoice_no = add_original_invoice
|
26
|
+
cancel_invoice(@invoice_no)
|
27
|
+
expect { @client.activate_invoice(invoice_no: @invoice_no,
|
28
|
+
store_id: "355",
|
29
|
+
country_code: "SE")
|
30
|
+
}.to raise_error Collector::InvoiceNotFoundError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
describe "Collector::Client#get_address" do
|
5
|
+
before :all do
|
6
|
+
@client = collector_client
|
7
|
+
end
|
8
|
+
it "performs a GetAddress request" do
|
9
|
+
VCR.use_cassette('get_address') do
|
10
|
+
user = @client.get_address(reg_no: "1602079954", store_id: "355")
|
11
|
+
user.should be_kind_of Collector::User
|
12
|
+
user.first_name.should eq "Förnamnakt211"
|
13
|
+
user.last_name.should eq "Efternamnakt211"
|
14
|
+
user.reg_no.should eq "1602079954"
|
15
|
+
user.addresses.should be_kind_of Array
|
16
|
+
address = user.addresses.first
|
17
|
+
address.should be_kind_of Collector::Address
|
18
|
+
address.address1.should eq "Gatuadressakt211"
|
19
|
+
address.address2.should be_nil
|
20
|
+
address.co_address.should be_nil
|
21
|
+
address.city.should eq "Umeå"
|
22
|
+
address.country_code.should eq "SE"
|
23
|
+
address.postal_code.should eq "90737"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
it "raises an error when handed an non-existing registration number" do
|
27
|
+
VCR.use_cassette('get_nonexisting_address') do
|
28
|
+
expect { @client.get_address(reg_no: "1602079955", store_id: "355") }.to raise_error{|err|
|
29
|
+
err.should be_a(Collector::CollectorError)
|
30
|
+
err.faultcode.should eq "INVALID_REGISTRATION_NUMBER"
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
describe "Collector::Client#replace_invoice" do
|
5
|
+
let(:new_rows) {
|
6
|
+
[ sandbox_invoice_row(article_id: 301, unit_price: 47.5, quantity: 1),
|
7
|
+
sandbox_invoice_row(article_id: 302, unit_price: 53.5, quantity: 2),
|
8
|
+
sandbox_invoice_row(article_id: 303, unit_price: 101.5, quantity: 3) ]
|
9
|
+
}
|
10
|
+
before :each do
|
11
|
+
@client = collector_client
|
12
|
+
@product = product2
|
13
|
+
end
|
14
|
+
def activate_invoice(invoice_no)
|
15
|
+
@client.activate_invoice(invoice_no: invoice_no,
|
16
|
+
store_id: "355",
|
17
|
+
country_code: "SE",
|
18
|
+
correlation_id: "testing_activate_invoice")
|
19
|
+
end
|
20
|
+
def replace_invoice(invoice_no, new_rows)
|
21
|
+
@client.replace_invoice(invoice_no: invoice_no,
|
22
|
+
store_id: "355",
|
23
|
+
country_code: "SE",
|
24
|
+
correlation_id: "testing_replace_invoice",
|
25
|
+
invoice_rows: new_rows)
|
26
|
+
end
|
27
|
+
it "performs a ReplaceInvoice request" do
|
28
|
+
VCR.use_cassette('replace_invoice') do
|
29
|
+
invoice_no = add_original_invoice
|
30
|
+
response = replace_invoice(invoice_no, new_rows)
|
31
|
+
response.correlation_id.should eq "testing_replace_invoice"
|
32
|
+
response.total_amount.to_f.should eq new_rows.inject(0) { |acc, row|
|
33
|
+
acc + row.unit_price * row.quantity
|
34
|
+
}
|
35
|
+
response.invoice_status.to_i.should eq 1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
it "doesn't perform a ReplaceInvoice request for an activated invoice" do
|
39
|
+
VCR.use_cassette('replace_activated_invoice') do
|
40
|
+
invoice_no = add_original_invoice
|
41
|
+
activate_invoice(invoice_no)
|
42
|
+
expect { replace_invoice(invoice_no, new_rows) }.to raise_error Collector::InvalidInvoiceStatusError
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'collector'
|
2
|
+
require 'require_all'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
require_rel 'helpers'
|
6
|
+
|
7
|
+
VCR.configure do |c|
|
8
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
9
|
+
c.hook_into :webmock
|
10
|
+
# c.debug_logger = $stdout
|
11
|
+
end
|
12
|
+
|
13
|
+
# logger = Logging.logger['root']
|
14
|
+
# logger.add_appenders(Logging.appenders.stdout)
|
15
|
+
# logger.level = :debug
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# config.filter_run focus: true
|
19
|
+
end
|
20
|
+
|
21
|
+
def collector_client
|
22
|
+
user_name = 'blingo_test'
|
23
|
+
password = 'blingo_test'
|
24
|
+
client = nil
|
25
|
+
VCR.use_cassette('create_client') do
|
26
|
+
client = Collector.new(user_name, password, true)
|
27
|
+
end
|
28
|
+
client
|
29
|
+
end
|
30
|
+
|
31
|
+
def product1
|
32
|
+
@product1 ||= sandbox_invoice_row(article_id: 101, unit_price: 47.5, quantity: 1)
|
33
|
+
end
|
34
|
+
def product2
|
35
|
+
@product2 ||= sandbox_invoice_row(article_id: 102, unit_price: 61.75, quantity: 2)
|
36
|
+
end
|
37
|
+
def product3
|
38
|
+
@product3 ||= sandbox_invoice_row(article_id: 103, unit_price: 73.15, quantity: 1)
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_original_invoice
|
42
|
+
req = sandbox_invoice_request
|
43
|
+
req.invoice_rows = [product1, product2, product3]
|
44
|
+
response = @client.add_invoice(req)
|
45
|
+
response.invoice_no
|
46
|
+
end
|
data/spec/user_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'active_support/core_ext'
|
4
|
+
|
5
|
+
describe Collector::User do
|
6
|
+
let (:raw_get_address_reponse_hash) {
|
7
|
+
{:get_address_response=>{:addresses=>
|
8
|
+
{:base_address=>
|
9
|
+
{:address1=>"Gatuadressakt211",
|
10
|
+
:address2=>nil,
|
11
|
+
:co_address=>nil,
|
12
|
+
:city=>"Umeå",
|
13
|
+
:country_code=>"SE",
|
14
|
+
:postal_code=>"90737"},
|
15
|
+
:"@xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance"},
|
16
|
+
:correlation_id=>nil,
|
17
|
+
:firstname=>"Förnamnakt211",
|
18
|
+
:lastname=>"Efternamnakt211",
|
19
|
+
:reg_no=>"1602079954",
|
20
|
+
:@xmlns=>"http://schemas.ecommerce.collector.se/v30/InvoiceService"}}
|
21
|
+
}
|
22
|
+
it "can be constructed from a hash" do
|
23
|
+
hash = raw_get_address_reponse_hash[:get_address_response].with_indifferent_access
|
24
|
+
user = Collector::User.new
|
25
|
+
Collector::UserRepresenter.new(user).from_hash(hash)
|
26
|
+
user.first_name.should eq "Förnamnakt211"
|
27
|
+
user.last_name.should eq "Efternamnakt211"
|
28
|
+
user.reg_no.should eq "1602079954"
|
29
|
+
user.addresses.should be_kind_of Array
|
30
|
+
address = user.addresses.first
|
31
|
+
address.should be_kind_of Collector::Address
|
32
|
+
address.address1.should eq "Gatuadressakt211"
|
33
|
+
address.address2.should be_nil
|
34
|
+
address.co_address.should be_nil
|
35
|
+
address.city.should eq "Umeå"
|
36
|
+
address.country_code.should eq "SE"
|
37
|
+
address.postal_code.should eq "90737"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/usage_example.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Run with: bundle exec ruby ./usage_example.rb
|
4
|
+
|
5
|
+
require 'collector'
|
6
|
+
|
7
|
+
address = Collector::Address.new(
|
8
|
+
address1: "GATUADRESSAKT211",
|
9
|
+
city: "UMEÅ",
|
10
|
+
country_code: "SE",
|
11
|
+
postal_code: "90737",
|
12
|
+
first_name: "FÖRNAMNAKT211",
|
13
|
+
last_name: "EFTERNAMNAKT211" )
|
14
|
+
|
15
|
+
invoice_row = Collector::InvoiceRow.new(
|
16
|
+
article_id: 12,
|
17
|
+
description: "A wonderful thing",
|
18
|
+
quantity: "2",
|
19
|
+
unit_price: 12.0,
|
20
|
+
vat: 2.0 )
|
21
|
+
|
22
|
+
invoice_request = Collector::InvoiceRequest.new(activation_option: 0,
|
23
|
+
country_code: "SE",
|
24
|
+
currency: "SEK",
|
25
|
+
delivery_address: address,
|
26
|
+
invoice_address: address,
|
27
|
+
invoice_delivery_method: 1,
|
28
|
+
invoice_rows: [invoice_row],
|
29
|
+
invoice_type: 0,
|
30
|
+
order_date: DateTime.now,
|
31
|
+
reg_no: "1602079954",
|
32
|
+
store_id: "355" )
|
33
|
+
|
34
|
+
user_name = 'blingo_test'
|
35
|
+
password = 'blingo_test'
|
36
|
+
|
37
|
+
collector = Collector.new(user_name, password)
|
38
|
+
response = collector.add_invoice(invoice_request)
|
39
|
+
puts "RESPONSE: #{response.inspect}"
|
metadata
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: collector-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Felix Holmgren
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: virtus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.5.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: representable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.13'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.13'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: require_all
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: vcr
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: commander
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: terminal-table
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: Client for the Collector API
|
168
|
+
email:
|
169
|
+
- felix.holmgren@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- .autotest
|
175
|
+
- .gitignore
|
176
|
+
- .rspec
|
177
|
+
- Gemfile
|
178
|
+
- LICENSE.txt
|
179
|
+
- README.md
|
180
|
+
- Rakefile
|
181
|
+
- collector-ruby.gemspec
|
182
|
+
- collector_browser.rb
|
183
|
+
- lib/collector.rb
|
184
|
+
- lib/collector/activate_invoice_request.rb
|
185
|
+
- lib/collector/address.rb
|
186
|
+
- lib/collector/adjust_invoice_request.rb
|
187
|
+
- lib/collector/article_list_item.rb
|
188
|
+
- lib/collector/base_model.rb
|
189
|
+
- lib/collector/cancel_invoice_request.rb
|
190
|
+
- lib/collector/client.rb
|
191
|
+
- lib/collector/get_address_request.rb
|
192
|
+
- lib/collector/invoice_request.rb
|
193
|
+
- lib/collector/invoice_response.rb
|
194
|
+
- lib/collector/invoice_row.rb
|
195
|
+
- lib/collector/replace_invoice_request.rb
|
196
|
+
- lib/collector/user.rb
|
197
|
+
- lib/collector/version.rb
|
198
|
+
- spec/address_spec.rb
|
199
|
+
- spec/article_list_item_spec.rb
|
200
|
+
- spec/base_model_spec.rb
|
201
|
+
- spec/helpers/sandbox_objects_helper.rb
|
202
|
+
- spec/invoice_request_spec.rb
|
203
|
+
- spec/invoice_response_spec.rb
|
204
|
+
- spec/invoice_row_spec.rb
|
205
|
+
- spec/operations/activate_invoice_spec.rb
|
206
|
+
- spec/operations/add_invoice_spec.rb
|
207
|
+
- spec/operations/adjust_invoice_spec.rb
|
208
|
+
- spec/operations/cancel_invoice_spec.rb
|
209
|
+
- spec/operations/get_address_spec.rb
|
210
|
+
- spec/operations/replace_invoice_spec.rb
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/user_spec.rb
|
213
|
+
- usage_example.rb
|
214
|
+
homepage: ''
|
215
|
+
licenses:
|
216
|
+
- MIT
|
217
|
+
metadata: {}
|
218
|
+
post_install_message:
|
219
|
+
rdoc_options: []
|
220
|
+
require_paths:
|
221
|
+
- lib
|
222
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - '>='
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
232
|
+
requirements: []
|
233
|
+
rubyforge_project:
|
234
|
+
rubygems_version: 2.0.3
|
235
|
+
signing_key:
|
236
|
+
specification_version: 4
|
237
|
+
summary: Just starting out
|
238
|
+
test_files:
|
239
|
+
- spec/address_spec.rb
|
240
|
+
- spec/article_list_item_spec.rb
|
241
|
+
- spec/base_model_spec.rb
|
242
|
+
- spec/helpers/sandbox_objects_helper.rb
|
243
|
+
- spec/invoice_request_spec.rb
|
244
|
+
- spec/invoice_response_spec.rb
|
245
|
+
- spec/invoice_row_spec.rb
|
246
|
+
- spec/operations/activate_invoice_spec.rb
|
247
|
+
- spec/operations/add_invoice_spec.rb
|
248
|
+
- spec/operations/adjust_invoice_spec.rb
|
249
|
+
- spec/operations/cancel_invoice_spec.rb
|
250
|
+
- spec/operations/get_address_spec.rb
|
251
|
+
- spec/operations/replace_invoice_spec.rb
|
252
|
+
- spec/spec_helper.rb
|
253
|
+
- spec/user_spec.rb
|