web-connect 0.4.13 → 0.4.14

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: 52cd6dd3ae425d48864e984ed72dd41b35ef1f4a
4
- data.tar.gz: ec3b4953d6f45e8be6074fb603145da6e78ba2a0
3
+ metadata.gz: b0091a07c1eed416170772b0b372bf7a67d07f3b
4
+ data.tar.gz: e8b5a76d60a63a5905d5789c0fcb7fbc930c008e
5
5
  SHA512:
6
- metadata.gz: e455749ad8bb95f79ebd8947eb3f4d02572ad7bfad0009cb5a40b042de0aa9791d9414536941fe9648c09fc6c8d4cde9c9d61974d7f50d8515612bd51f22f98e
7
- data.tar.gz: 6c8036b621934fb75db6ba1d082d8f370fb00e6d3c11039bdea5c86e0d91e8a721b4932ab8a860f6a5ad3c1b386f8094a311ac892ac2ceeb03a275bcb550d1c0
6
+ metadata.gz: 56f5c259161af9445688c69243e03ceb03960bcda139c0bae524417dd27720da9e31760a36b9518ef277439f0778109230f3e61276adf497c6678d8141202fb3
7
+ data.tar.gz: 2bbc7b22019d05b8e344174bc20bed10c44389049bfb1855c9a4406ca6143bad5012a029ceed9653a98b755139855c5fefdaa43b505756d0f31a7b4ca950febd
@@ -37,7 +37,7 @@ module Netfira::WebConnect
37
37
 
38
38
  # Used by older downstream methods, e.g. newOrders, newInboundDocuments etc
39
39
  def to_deprecated_downstream
40
- fields = attributes_as_camel_cased_hash
40
+ fields = attributes_as_camel_cased_hash(true)
41
41
  if sendable?
42
42
  sendable_fields = {
43
43
  "#{self.class.single_name_camel}GUID" => guid.to_s,
@@ -53,14 +53,19 @@ module Netfira::WebConnect
53
53
  @guid ||= Guid.from(self[:guid])
54
54
  end
55
55
 
56
- def guid=(value)
56
+ def guid=(_)
57
57
  raise 'GUIDs are read-only'
58
58
  end
59
59
 
60
60
  private
61
61
 
62
- def attributes_as_camel_cased_hash
63
- self.class.attributes_to_send.map { |key| [key.camelize(:lower), __send__(key).to_s] }.to_h
62
+ def attributes_as_camel_cased_hash(stringify = false)
63
+ self.class.attributes_to_send.map do |key|
64
+ value = __send__(key)
65
+ value = value.to_f if BigDecimal === value
66
+ value = value.to_s if stringify
67
+ [key.camelize(:lower), value]
68
+ end.to_h
64
69
  end
65
70
 
66
71
  def deprecated_downstream_children
@@ -41,10 +41,19 @@ module Netfira::WebConnect
41
41
  env['original.rack.input'] = input = env['rack.input']
42
42
 
43
43
  input = case env['CONTENT_ENCODING'] || env['HTTP_CONTENT_ENCODING']
44
- when 'gzip' then Zlib::GzipReader.new(input)
45
- when 'deflate' then StringIO.new(Zlib::Inflate.inflate input.read)
46
- else input
47
- end
44
+ when 'gzip'
45
+ Zlib::GzipReader.new(input)
46
+ when 'deflate'
47
+ begin
48
+ # Decompression of .Net-flavoured deflate
49
+ StringIO.new(Zlib::Inflate.new(-15).inflate input.read)
50
+ rescue Zlib::DataError
51
+ # Decompression of regular (Ruby, PHP etc) deflate
52
+ StringIO.new(Zlib::Inflate.inflate input.tap(&:rewind).read)
53
+ end
54
+ else
55
+ input
56
+ end
48
57
 
49
58
  method, path, query_string, headers, body = parse_request(input)
50
59
 
@@ -1,6 +1,6 @@
1
1
  module Netfira
2
2
  module WebConnect
3
- VERSION = '0.4.13'
3
+ VERSION = '0.4.14'
4
4
  PLATFORM_AND_VERSION = 'Rack/' << VERSION
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson