sendregning 0.1.3 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/sendregning.rb +5 -1
- data/lib/sendregning/client.rb +49 -88
- data/lib/sendregning/invoice.rb +40 -83
- data/lib/sendregning/invoice_parser.rb +43 -0
- data/lib/sendregning/invoice_serializer.rb +57 -0
- data/lib/sendregning/line.rb +13 -30
- data/lib/sendregning/line_serializer.rb +14 -0
- data/lib/sendregning/version.rb +1 -1
- data/lib/sendregning/xml_serializer.rb +37 -0
- data/sendregning.gemspec +4 -4
- metadata +15 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac9aebbc32da82e3b79fe52e4383f3e86502bf66
|
4
|
+
data.tar.gz: c481e3697c7d335562b515f938e09bb264216ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb8c3a1194f57636a9f6c4d075c065db6c886d4bef8567e7d11fc4167c4e0e3381f1e39d552fa7f811143fad7a8f122e71efefacf85c591f4b7ad4925be80aa
|
7
|
+
data.tar.gz: 608b5eb4805de3d086083891abaed6b2aeb8b4014ad9e0e1671ad849e8615244e0675d6ee993281074ab253efa652c2db11f7f33b49daffd0b412a582079c355
|
data/lib/sendregning.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'builder'
|
3
|
-
require 'net/http/post/multipart'
|
4
3
|
require 'httparty'
|
4
|
+
require 'httmultiparty'
|
5
5
|
|
6
6
|
dir = Pathname(__FILE__).dirname.expand_path
|
7
7
|
|
8
|
+
require dir + 'sendregning/xml_serializer'
|
8
9
|
require dir + 'sendregning/client'
|
9
10
|
require dir + 'sendregning/invoice'
|
11
|
+
require dir + 'sendregning/invoice_parser'
|
12
|
+
require dir + 'sendregning/invoice_serializer'
|
10
13
|
require dir + 'sendregning/line'
|
14
|
+
require dir + 'sendregning/line_serializer'
|
11
15
|
require dir + 'sendregning/version'
|
12
16
|
|
13
17
|
module Sendregning
|
data/lib/sendregning/client.rb
CHANGED
@@ -7,9 +7,9 @@ module Sendregning
|
|
7
7
|
# Usage example:
|
8
8
|
#
|
9
9
|
# client = SendRegning::Client.new(my_username, my_password)
|
10
|
-
|
10
|
+
|
11
11
|
class Client
|
12
|
-
include
|
12
|
+
include HTTMultiParty
|
13
13
|
|
14
14
|
base_uri 'https://www.sendregning.no'
|
15
15
|
format :xml
|
@@ -18,101 +18,62 @@ module Sendregning
|
|
18
18
|
@auth = {:username => username, :password => password}
|
19
19
|
@test = true if options[:test]
|
20
20
|
end
|
21
|
-
|
22
|
-
public
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
# Performs a GET request
|
23
|
+
def get(query={})
|
24
|
+
self.class.get('/ws/butler.do', query_options(query))
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# Performs a POST request with an XML payload
|
35
|
-
def post_xml(xml, body={})
|
36
|
-
# Prepare the request
|
37
|
-
url = URI.parse("#{self.class.base_uri}/ws/butler.do")
|
38
|
-
body[:xml] = UploadIO.new(StringIO.new(xml), 'text/xml', 'request.xml')
|
39
|
-
body[:test] = true if @test
|
40
|
-
request = Net::HTTP::Post::Multipart.new(url.path, body)
|
41
|
-
request.basic_auth @auth[:username], @auth[:password]
|
42
|
-
|
43
|
-
# Perform request
|
44
|
-
http = Net::HTTP.new(url.host, url.port)
|
45
|
-
http.use_ssl = true
|
46
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
47
|
-
res = http.start{|http| http.request(request)}
|
27
|
+
# Performs a POST request
|
28
|
+
def post(query=nil)
|
29
|
+
self.class.post('/ws/butler.do', query_options(query))
|
30
|
+
end
|
48
31
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# Returns a list of recipients
|
54
|
-
def recipients
|
55
|
-
response = get(:action => 'select', :type => 'recipient')
|
56
|
-
response['recipients']['recipient']
|
57
|
-
end
|
58
|
-
|
59
|
-
# Instances a new invoice
|
60
|
-
def new_invoice(attributes={})
|
61
|
-
Sendregning::Invoice.new(attributes.merge({:client => self}))
|
62
|
-
end
|
63
|
-
|
64
|
-
# Sends an invoice
|
65
|
-
def send_invoice(invoice)
|
66
|
-
response = post_xml(invoice.to_xml, {:action => 'send', :type => 'invoice'})
|
67
|
-
parse_invoice(response['invoices']['invoice'], invoice)
|
68
|
-
end
|
69
|
-
|
70
|
-
# Finds an invoice by invoice number
|
71
|
-
def find_invoice(invoice_id)
|
72
|
-
builder = Builder::XmlMarkup.new(:indent=>2)
|
73
|
-
builder.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
74
|
-
request_xml = builder.select do |select|
|
75
|
-
select.invoiceNumbers do |numbers|
|
76
|
-
numbers.invoiceNumber invoice_id
|
77
|
-
end
|
78
|
-
end
|
79
|
-
response = post_xml(request_xml, {:action => 'select', :type => 'invoice'})
|
80
|
-
parse_invoice(response['invoices']['invoice']) rescue nil
|
81
|
-
end
|
82
|
-
|
32
|
+
def post_xml(xml, query={})
|
33
|
+
query[:xml] = xml_file(xml)
|
34
|
+
self.class.post('/ws/butler.do', query_options(query).merge(detect_mime_type: true))
|
35
|
+
end
|
83
36
|
|
84
|
-
|
37
|
+
# Returns a list of recipients
|
38
|
+
def recipients
|
39
|
+
response = get(:action => 'select', :type => 'recipient')
|
40
|
+
response['recipients']['recipient']
|
41
|
+
end
|
85
42
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
new_hash
|
92
|
-
end
|
43
|
+
# Instances a new invoice
|
44
|
+
def new_invoice(attributes={})
|
45
|
+
Sendregning::Invoice.new(attributes.merge({:client => self}))
|
46
|
+
end
|
93
47
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
end
|
100
|
-
if attributes['shipment']
|
101
|
-
attributes = attributes.merge(attributes['shipment'])
|
102
|
-
attributes.delete('shipment')
|
103
|
-
end
|
104
|
-
lines = attributes['lines']['line']; attributes.delete('lines')
|
48
|
+
# Sends an invoice
|
49
|
+
def send_invoice(invoice)
|
50
|
+
response = post_xml(invoice.to_xml, {:action => 'send', :type => 'invoice'})
|
51
|
+
InvoiceParser.parse(response, invoice)
|
52
|
+
end
|
105
53
|
|
106
|
-
|
107
|
-
|
108
|
-
|
54
|
+
# Finds an invoice by invoice number
|
55
|
+
def find_invoice(invoice_id)
|
56
|
+
builder = Builder::XmlMarkup.new(:indent=>2)
|
57
|
+
builder.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
58
|
+
request_xml = builder.select do |select|
|
59
|
+
select.invoiceNumbers do |numbers|
|
60
|
+
numbers.invoiceNumber invoice_id
|
61
|
+
end
|
109
62
|
end
|
63
|
+
response = post_xml(request_xml, {:action => 'select', :type => 'invoice'})
|
64
|
+
InvoiceParser.parse(response) rescue nil
|
65
|
+
end
|
110
66
|
|
111
|
-
|
112
|
-
def query_options(query={})
|
113
|
-
query[:test] = 'true' if @test
|
114
|
-
{:basic_auth => @auth, :query => query}
|
115
|
-
end
|
67
|
+
protected
|
116
68
|
|
69
|
+
# Prepares options for a request
|
70
|
+
def query_options(query={})
|
71
|
+
query[:test] = 'true' if @test
|
72
|
+
{:basic_auth => @auth, :query => query}
|
73
|
+
end
|
74
|
+
|
75
|
+
def xml_file(xml)
|
76
|
+
UploadIO.new(StringIO.new(xml), 'text/xml', 'request.xml')
|
77
|
+
end
|
117
78
|
end
|
118
79
|
end
|
data/lib/sendregning/invoice.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Sendregning
|
2
2
|
|
3
3
|
class Invoice
|
4
|
-
|
5
4
|
OPTIONAL_ATTRIBUTES = [
|
6
5
|
# Request
|
7
6
|
:invoiceType, :creditedId, :orderNo, :invoiceDate, :orderNo,
|
@@ -16,7 +15,7 @@ module Sendregning
|
|
16
15
|
SHIPMENT_ATTRIBUTES = [
|
17
16
|
:shipment, :emailaddresses, :copyaddresses
|
18
17
|
]
|
19
|
-
|
18
|
+
|
20
19
|
SHIPMENT_MODES = {
|
21
20
|
:paper => 'PAPER',
|
22
21
|
:email => 'EMAIL',
|
@@ -32,7 +31,7 @@ module Sendregning
|
|
32
31
|
self.update(attributes)
|
33
32
|
@lines = []
|
34
33
|
end
|
35
|
-
|
34
|
+
|
36
35
|
def update(attributes={})
|
37
36
|
@client = attributes[:client] if attributes[:client]
|
38
37
|
@name = attributes[:name] if attributes[:name]
|
@@ -47,101 +46,59 @@ module Sendregning
|
|
47
46
|
@lines << line
|
48
47
|
line
|
49
48
|
end
|
50
|
-
|
49
|
+
|
51
50
|
# Sends an invoice
|
52
51
|
def send!
|
53
52
|
self.client.send_invoice(self)
|
54
53
|
end
|
55
|
-
|
54
|
+
|
56
55
|
def paid?
|
57
56
|
state == 'paid'
|
58
57
|
end
|
59
58
|
|
59
|
+
def shipment_mode
|
60
|
+
mode = (@shipment[:shipment] || :paper).to_sym
|
61
|
+
raise 'Invalid shipment mode!' unless SHIPMENT_MODES.keys.include?(mode)
|
62
|
+
SHIPMENT_MODES[mode]
|
63
|
+
end
|
64
|
+
|
60
65
|
# Renders invoice to XML
|
61
66
|
def to_xml(options={})
|
62
|
-
|
63
|
-
xml = options[:builder]
|
64
|
-
else
|
65
|
-
xml = Builder::XmlMarkup.new(:indent=>2)
|
66
|
-
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
67
|
-
end
|
68
|
-
xml.invoices do |invoices|
|
69
|
-
invoices.invoice do |invoice|
|
70
|
-
invoice.name @name
|
71
|
-
invoice.zip @zip
|
72
|
-
invoice.city @city
|
73
|
-
|
74
|
-
# Lines
|
75
|
-
if @lines.length > 0
|
76
|
-
invoice.lines do |line_builder|
|
77
|
-
@lines.each{|l| l.to_xml(:builder => line_builder)}
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# Optional attributes
|
82
|
-
if @optional.length > 0
|
83
|
-
invoice.optional do |optional|
|
84
|
-
@optional.each do |key, value|
|
85
|
-
key = key.to_sym
|
86
|
-
if value.kind_of?(Date) || value.kind_of?(Time)
|
87
|
-
value = value.strftime("%d.%m.%y")
|
88
|
-
end
|
89
|
-
optional.tag! key, value
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Shipment attributes
|
95
|
-
if @shipment.length > 0
|
96
|
-
invoice.shipment do |shipment|
|
97
|
-
shipment_mode = (@shipment[:shipment] || :paper).to_sym
|
98
|
-
raise 'Invalid shipment mode!' unless SHIPMENT_MODES.keys.include?(shipment_mode)
|
99
|
-
shipment_mode = SHIPMENT_MODES[shipment_mode]
|
100
|
-
|
101
|
-
shipment.text! shipment_mode
|
102
|
-
@shipment.each do |key, values|
|
103
|
-
key = key.to_sym
|
104
|
-
unless key == :shipment
|
105
|
-
values = [values] unless values.kind_of?(Enumerable)
|
106
|
-
shipment.tag! key do |emails|
|
107
|
-
values.each{|v| emails.email v}
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
67
|
+
InvoiceSerializer.build(self, options)
|
115
68
|
end
|
116
69
|
|
117
70
|
protected
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
124
|
-
@optional
|
71
|
+
|
72
|
+
def optional=(attributes)
|
73
|
+
@optional ||= {}
|
74
|
+
attributes.each do |key, value|
|
75
|
+
@optional[key.to_sym] = value if OPTIONAL_ATTRIBUTES.include?(key.to_sym)
|
125
76
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
@shipment
|
77
|
+
@optional
|
78
|
+
end
|
79
|
+
|
80
|
+
def shipment=(attributes)
|
81
|
+
@shipment ||= {}
|
82
|
+
attributes.each do |key, value|
|
83
|
+
@shipment[key.to_sym] = value if SHIPMENT_ATTRIBUTES.include?(key.to_sym)
|
133
84
|
end
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
85
|
+
@shipment
|
86
|
+
end
|
87
|
+
|
88
|
+
def method_missing(method, *args)
|
89
|
+
if OPTIONAL_ATTRIBUTES.include?(method)
|
90
|
+
@optional[method]
|
91
|
+
elsif SHIPMENT_ATTRIBUTES.include?(method)
|
92
|
+
@shipping[method]
|
93
|
+
else
|
94
|
+
super
|
143
95
|
end
|
144
|
-
|
145
|
-
end
|
96
|
+
end
|
146
97
|
|
98
|
+
def xml_builder
|
99
|
+
xml = Builder::XmlMarkup.new(:indent=>2)
|
100
|
+
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
101
|
+
xml
|
102
|
+
end
|
103
|
+
end
|
147
104
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sendregning
|
2
|
+
class InvoiceParser
|
3
|
+
class << self
|
4
|
+
def parse(response, invoice=Sendregning::Invoice.new)
|
5
|
+
self.new(response, invoice).parse
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(response, invoice)
|
10
|
+
@response = response
|
11
|
+
@invoice = invoice
|
12
|
+
end
|
13
|
+
|
14
|
+
def parse
|
15
|
+
attributes = @response['invoices']['invoice']
|
16
|
+
|
17
|
+
# Flatten optional and shipment attributes
|
18
|
+
%w{optional shipment}.each do |section|
|
19
|
+
if attributes.has_key?(section)
|
20
|
+
attributes = attributes.merge(attributes[section])
|
21
|
+
attributes.delete(section)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
lines = attributes['lines']['line']
|
26
|
+
attributes.delete('lines')
|
27
|
+
|
28
|
+
@invoice.update(stringify_hash(attributes))
|
29
|
+
@invoice.lines = lines.map {|l| Sendregning::Line.new(stringify_hash(l)) }
|
30
|
+
@invoice
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def stringify_hash(hash)
|
36
|
+
new_hash = {}
|
37
|
+
hash.each do |key, value|
|
38
|
+
new_hash[key] = "#{value}"
|
39
|
+
end
|
40
|
+
new_hash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Sendregning
|
2
|
+
class InvoiceSerializer < Sendregning::XmlSerializer
|
3
|
+
def build
|
4
|
+
builder.invoices do |invoices|
|
5
|
+
invoices.invoice do |invoice|
|
6
|
+
invoice.name item.name
|
7
|
+
invoice.zip item.zip
|
8
|
+
invoice.city item.city
|
9
|
+
|
10
|
+
lines(invoice)
|
11
|
+
optional_attributes(invoice)
|
12
|
+
shipment_attributes(invoice)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def lines(invoice)
|
20
|
+
if item.lines.any?
|
21
|
+
invoice.lines do |line_builder|
|
22
|
+
item.lines.each { |l| l.to_xml(builder: line_builder) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def optional_attributes(invoice)
|
28
|
+
if item.optional.any?
|
29
|
+
invoice.optional do |optional|
|
30
|
+
item.optional.each do |key, value|
|
31
|
+
key = key.to_sym
|
32
|
+
if value.kind_of?(Date) || value.kind_of?(Time)
|
33
|
+
value = value.strftime("%d.%m.%y")
|
34
|
+
end
|
35
|
+
optional.tag! key, value
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def shipment_attributes(invoice)
|
42
|
+
if item.shipment.any?
|
43
|
+
invoice.shipment do |shipment|
|
44
|
+
shipment.text! item.shipment_mode
|
45
|
+
item.shipment.each do |key, values|
|
46
|
+
key = key.to_sym
|
47
|
+
unless key == :shipment
|
48
|
+
shipment.tag! key do |emails|
|
49
|
+
Array(values).each { |v| emails.email v }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/sendregning/line.rb
CHANGED
@@ -1,59 +1,42 @@
|
|
1
1
|
module Sendregning
|
2
|
-
|
3
2
|
class Line
|
4
|
-
|
5
3
|
# Quantity, as decimal. Example: '7,5'
|
6
4
|
attr_accessor :qty
|
7
|
-
|
5
|
+
|
8
6
|
# Product code. String, max length: 9
|
9
7
|
attr_accessor :prodCode
|
10
|
-
|
8
|
+
|
11
9
|
# Description. String, max length: 75
|
12
10
|
attr_accessor :desc
|
13
|
-
|
11
|
+
|
14
12
|
# Price per unit in decimal. Example: '250,00'
|
15
13
|
attr_accessor :unitPrice
|
16
|
-
|
14
|
+
|
17
15
|
# Discount in percentage as decimal. Optional, defaults to 0
|
18
16
|
attr_accessor :discount
|
19
17
|
|
20
18
|
# Tax rate. Valid rates are: '0', '8', '13' and '25'. Default: '25'
|
21
19
|
attr_accessor :tax
|
22
|
-
|
20
|
+
|
23
21
|
attr_accessor :itemNo, :lineTaxAmount, :lineTotal
|
24
22
|
|
25
23
|
def initialize(new_attributes={})
|
26
24
|
self.attributes = new_attributes
|
27
25
|
end
|
28
|
-
|
26
|
+
|
29
27
|
# Renders line to XML
|
30
28
|
def to_xml(options={})
|
31
|
-
|
32
|
-
xml = options[:builder]
|
33
|
-
else
|
34
|
-
xml = Builder::XmlMarkup.new(:indent=>2)
|
35
|
-
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
36
|
-
end
|
37
|
-
xml.line do |line|
|
38
|
-
line.qty self.qty if @qty
|
39
|
-
line.prodCode self.prodCode if @prodCode
|
40
|
-
line.desc self.desc if @desc
|
41
|
-
line.unitPrice self.unitPrice if @unitPrice
|
42
|
-
line.discount self.discount if @discount
|
43
|
-
line.tax self.tax if @tax
|
44
|
-
end
|
29
|
+
LineSerializer.build(self, options)
|
45
30
|
end
|
46
31
|
|
47
32
|
protected
|
48
33
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
attributes
|
34
|
+
def attributes=(attributes={})
|
35
|
+
attributes.each do |key, value|
|
36
|
+
set_method = "#{key.to_s}=".to_sym
|
37
|
+
self.send(set_method, value) if self.respond_to?(set_method)
|
55
38
|
end
|
56
|
-
|
39
|
+
attributes
|
40
|
+
end
|
57
41
|
end
|
58
|
-
|
59
42
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Sendregning
|
2
|
+
class LineSerializer < Sendregning::XmlSerializer
|
3
|
+
def build
|
4
|
+
builder.line do |line|
|
5
|
+
line.qty item.qty if item.qty
|
6
|
+
line.prodCode item.prodCode if item.prodCode
|
7
|
+
line.desc item.desc if item.desc
|
8
|
+
line.unitPrice item.unitPrice if item.unitPrice
|
9
|
+
line.discount item.discount if item.discount
|
10
|
+
line.tax item.tax if item.tax
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/sendregning/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sendregning
|
2
|
+
class XmlSerializer
|
3
|
+
class << self
|
4
|
+
def build(item, options={})
|
5
|
+
builder = options[:builder] || xml_builder
|
6
|
+
self.new(item, builder).build
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def xml_builder
|
12
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
13
|
+
xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
|
14
|
+
xml
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(item, builder)
|
19
|
+
@item = item
|
20
|
+
@builder = builder
|
21
|
+
end
|
22
|
+
|
23
|
+
def build
|
24
|
+
raise "XmlSerializer is an abstract class, subclass and overwrite the build method"
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def builder
|
30
|
+
@builder
|
31
|
+
end
|
32
|
+
|
33
|
+
def item
|
34
|
+
@item
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/sendregning.gemspec
CHANGED
@@ -13,14 +13,14 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.email = 'inge@manualdesign.no'
|
14
14
|
s.homepage = 'http://github.com/elektronaut/sendregning'
|
15
15
|
s.license = 'MIT'
|
16
|
-
s.required_ruby_version = Gem::Requirement.new(">= 1.
|
16
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
|
17
17
|
|
18
18
|
s.files = `git ls-files`.split("\n")
|
19
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
-
s.add_runtime_dependency 'httparty', '0.
|
24
|
-
s.add_runtime_dependency 'builder', '~>
|
25
|
-
s.add_runtime_dependency '
|
23
|
+
s.add_runtime_dependency 'httparty', '~> 0.13.0'
|
24
|
+
s.add_runtime_dependency 'builder', '~> 3.1'
|
25
|
+
s.add_runtime_dependency 'httmultiparty', '~> 0.3'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sendregning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inge Jørgensen
|
@@ -14,44 +14,44 @@ dependencies:
|
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.13.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: httmultiparty
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0.3'
|
55
55
|
description: Ruby client for the SendRegning Web Service
|
56
56
|
email: inge@manualdesign.no
|
57
57
|
executables: []
|
@@ -64,8 +64,12 @@ files:
|
|
64
64
|
- lib/sendregning.rb
|
65
65
|
- lib/sendregning/client.rb
|
66
66
|
- lib/sendregning/invoice.rb
|
67
|
+
- lib/sendregning/invoice_parser.rb
|
68
|
+
- lib/sendregning/invoice_serializer.rb
|
67
69
|
- lib/sendregning/line.rb
|
70
|
+
- lib/sendregning/line_serializer.rb
|
68
71
|
- lib/sendregning/version.rb
|
72
|
+
- lib/sendregning/xml_serializer.rb
|
69
73
|
- sendregning.gemspec
|
70
74
|
homepage: http://github.com/elektronaut/sendregning
|
71
75
|
licenses:
|
@@ -79,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
83
|
requirements:
|
80
84
|
- - ">="
|
81
85
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
86
|
+
version: 1.9.3
|
83
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
88
|
requirements:
|
85
89
|
- - ">="
|