klarna-checkout 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99dbc87a1758ccba7b8707c8afa2fbcb5a4d5271
4
- data.tar.gz: b5f08fb9d850af9cb1dd82dc8c9d4d3084d236b4
3
+ metadata.gz: 68c4ba576274af3db9c447772890887e1629b4b5
4
+ data.tar.gz: 2756414abb23952ead4aae51f7b199b690b29bb8
5
5
  SHA512:
6
- metadata.gz: 7adf77484ebe60253d5c2cad1b800edaea3ebc25d5af7aa23720367b28df80f7acc92f11fe71b3bdb2f2de72073ba919a971a31a40bf7e6e6eddccb1e7e413f9
7
- data.tar.gz: 2c8122a05a62840e2f2ab2aa06923b0c9c8a37e3249f7192e7e07d9d4faa25d21de9294c3268803d55f2907282270df3de2813fb048bd16de94c1cb024962543
6
+ metadata.gz: e0a29c206f6ec94ae8c7a23ad66c05665c23bd3c0121c11f42519507f7a2367d5acf0b46f781848f6d84c8d430cc34d121ce5e0468bfe8a38c4d3edb75642fe8
7
+ data.tar.gz: 5b209756de08e709f2e48e342b9d87ec32446d81ef432b35a8406ce11f13a25effb323aa0adc4a683e6dd37a925f1ac0ba0367a79031d1a3da6358b43d22f875
@@ -5,7 +5,7 @@ module Klarna
5
5
  :postal_code, :city, :country, :email, :phone
6
6
 
7
7
  def as_json
8
- {
8
+ json_sanitize({
9
9
  :given_name => @given_name,
10
10
  :family_name => @family_name,
11
11
  :care_of => @care_of,
@@ -15,7 +15,7 @@ module Klarna
15
15
  :country => @country,
16
16
  :email => @email,
17
17
  :phone => @phone
18
- }
18
+ })
19
19
  end
20
20
  end
21
21
  end
@@ -9,12 +9,12 @@ module Klarna
9
9
  has_many :items, Klarna::Checkout::CartItem
10
10
 
11
11
  def as_json
12
- {
12
+ json_sanitize({
13
13
  :total_price_including_tax => @total_price_including_tax,
14
14
  :total_price_excluding_tax => @total_price_excluding_tax,
15
15
  :total_tax_amount => @total_tax_amount,
16
16
  :items => @items.map(&:as_json)
17
- }
17
+ })
18
18
  end
19
19
  end
20
20
  end
@@ -6,7 +6,7 @@ module Klarna
6
6
  :total_price_including_tax, :discount_rate, :tax_rate
7
7
 
8
8
  def as_json
9
- {
9
+ json_sanitize({
10
10
  :type => @type,
11
11
  :ean => @ean,
12
12
  :reference => @reference,
@@ -20,7 +20,7 @@ module Klarna
20
20
  :total_price_including_tax => @total_price_including_tax,
21
21
  :discount_rate => @discount_rate,
22
22
  :tax_rate => @tax_rate
23
- }
23
+ })
24
24
  end
25
25
  end
26
26
  end
@@ -4,9 +4,9 @@ module Klarna
4
4
  attr_accessor :type
5
5
 
6
6
  def as_json
7
- {
7
+ json_sanitize({
8
8
  :type => @type
9
- }
9
+ })
10
10
  end
11
11
  end
12
12
  end
@@ -4,10 +4,10 @@ module Klarna
4
4
  attr_accessor :layout, :options, :snippet
5
5
 
6
6
  def as_json
7
- {
7
+ json_sanitize({
8
8
  :layout => @layout,
9
9
  :options => @options
10
- }
10
+ })
11
11
  end
12
12
  end
13
13
  end
@@ -5,14 +5,14 @@ module Klarna
5
5
  :push_uri, :validation_uri
6
6
 
7
7
  def as_json
8
- {
8
+ json_sanitize({
9
9
  :id => @id,
10
10
  :terms_uri => @terms_uri,
11
11
  :checkout_uri => @checkout_uri,
12
12
  :confirmation_uri => @confirmation_uri,
13
13
  :push_uri => @push_uri,
14
14
  :validation_uri => @validation_uri
15
- }
15
+ })
16
16
  end
17
17
  end
18
18
  end
@@ -17,16 +17,14 @@ module Klarna
17
17
  has_one :gui, Klarna::Checkout::Gui
18
18
 
19
19
  def as_json
20
- {
20
+ json_sanitize({
21
21
  :merchant_reference => @merchant_reference,
22
22
  :purchase_country => @purchase_country,
23
23
  :purchase_currency => @purchase_currency,
24
24
  :locale => @locale,
25
25
  :cart => @cart.as_json,
26
26
  :merchant => @merchant.as_json
27
- }.reject do |k, v|
28
- v.nil?
29
- end
27
+ })
30
28
  end
31
29
  end
32
30
  end
@@ -16,9 +16,13 @@ module Klarna
16
16
  end
17
17
 
18
18
  def to_json
19
- sanitized_json = self.as_json.reject { |k, v| v.nil? }
19
+ sanitized_json = json_sanitize(self.as_json)
20
20
  JSON.generate(sanitized_json)
21
21
  end
22
+
23
+ def json_sanitize(hash)
24
+ hash.reject { |k, v| v.nil? }
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -1,5 +1,5 @@
1
1
  module Klarna
2
2
  module Checkout
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  require 'klarna/checkout/version'
2
2
 
3
3
  describe Klarna::Checkout::VERSION do
4
- it { should eq '0.0.4' }
4
+ it { should eq '0.0.5' }
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klarna-checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theodor Tonum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday