sendregning 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac9aebbc32da82e3b79fe52e4383f3e86502bf66
4
- data.tar.gz: c481e3697c7d335562b515f938e09bb264216ef1
3
+ metadata.gz: dc6f997dcd481f5713e113f3f10805359e10aab8
4
+ data.tar.gz: fc89a4e0e1262b00803aff4d348009ad8bf550b6
5
5
  SHA512:
6
- metadata.gz: 1bb8c3a1194f57636a9f6c4d075c065db6c886d4bef8567e7d11fc4167c4e0e3381f1e39d552fa7f811143fad7a8f122e71efefacf85c591f4b7ad4925be80aa
7
- data.tar.gz: 608b5eb4805de3d086083891abaed6b2aeb8b4014ad9e0e1671ad849e8615244e0675d6ee993281074ab253efa652c2db11f7f33b49daffd0b412a582079c355
6
+ metadata.gz: fce9bb3804d9194b6fa826bec419b557b0224207b8a04e5378c9492ca9b783e251bb1339d41bb0a85b8b48d4b3182d5d0c78c6d3c26328b855f8d15deceec39a
7
+ data.tar.gz: e97edf4f3420b455eb51d4ff8e53f7eb03a5856f3ec0071a091f539f7cf5563f980663cc72160dc67db6b6e73d3d25eccce97afe394cd6c3550b0135904efb75
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Sendregning
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/elektronaut/sendregning.png)](https://codeclimate.com/github/elektronaut/sendregning)
4
+
3
5
  Ruby client for the SendRegning Web Service.
4
6
 
5
7
  ## Getting started
@@ -69,36 +69,28 @@ module Sendregning
69
69
 
70
70
  protected
71
71
 
72
+ def filter_attributes(attributes, filter)
73
+ attributes.dup.delete_if { |k, v| !filter.include?(k.to_sym) }
74
+ end
75
+
72
76
  def optional=(attributes)
73
77
  @optional ||= {}
74
- attributes.each do |key, value|
75
- @optional[key.to_sym] = value if OPTIONAL_ATTRIBUTES.include?(key.to_sym)
76
- end
77
- @optional
78
+ @optional.merge!(filter_attributes(attributes, OPTIONAL_ATTRIBUTES))
78
79
  end
79
80
 
80
81
  def shipment=(attributes)
81
82
  @shipment ||= {}
82
- attributes.each do |key, value|
83
- @shipment[key.to_sym] = value if SHIPMENT_ATTRIBUTES.include?(key.to_sym)
84
- end
85
- @shipment
83
+ @shipment.merge!(filter_attributes(attributes, SHIPMENT_ATTRIBUTES))
86
84
  end
87
85
 
88
86
  def method_missing(method, *args)
89
87
  if OPTIONAL_ATTRIBUTES.include?(method)
90
88
  @optional[method]
91
89
  elsif SHIPMENT_ATTRIBUTES.include?(method)
92
- @shipping[method]
90
+ @shipment[method]
93
91
  else
94
92
  super
95
93
  end
96
94
  end
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
95
  end
104
96
  end
@@ -1,5 +1,5 @@
1
1
  module Sendregning
2
2
  unless Sendregning.const_defined?('VERSION')
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
@@ -91,8 +91,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.2.0
94
+ rubygems_version: 2.4.1
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Ruby client for the SendRegning Web Service
98
98
  test_files: []
99
+ has_rdoc: