ruby-fiix-cmms-client 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: e9869f6020778153f7836b0d77af9238ffa5f334192098a76bb421117cbd70d8
4
- data.tar.gz: c065c5d1e9a47cf28e70ecda4c9698d6b5212f78105302bccdb129e40c7e65cf
3
+ metadata.gz: 85d93105c64e8d17809da0de80ba5113b108fa85db720633ab0c47570d463be5
4
+ data.tar.gz: b93b7c6cd2b7cb56f680d08e270427515afc0e7ac0bb6d31529ddc858693cd7a
5
5
  SHA512:
6
- metadata.gz: 6273384a2acc4ba6297dac1cf182b97f621446e95f825b1172e70fb99bcf46e4839b1aecc429c19d7d83cfb865fc2c9acb2167e9c7787a3daf206a35d835142a
7
- data.tar.gz: da1cc68df6842f83a835442ecd6d5f2fb59fc992106bc7c9dc6707bbbc0b6062099d5e4659158afbf5b79eae2a16198626fa10134920600506545effc0e0f6b2
6
+ metadata.gz: 34e93a0578c2059165477ac8a61c0e6b7307a6661380d2090f51dc680654b34e372594499a5365dc6a4311f32a2ff84a37138194b31415847ea98afa9edc88ac
7
+ data.tar.gz: 04f2f8b3a0c94945a229bbac2da2f0bd5f06d5d8d5aad376e810d4d8a3123f0d13af4a1f1b5b7fd7e0d8c8a6c8c9ed0bfb670d4ce7b9c176224cc801c429b93c
@@ -47,7 +47,13 @@ module Ruby
47
47
  def upload_file(context)
48
48
  normalized = normalize_context(context)
49
49
  file = normalized.delete("file")
50
- multipart_request(normalized, file)
50
+
51
+ # Build the JSON payload with _maCn and clientVersion, same as regular requests
52
+ payload = { "_maCn" => "AddRequest" }
53
+ .merge(DEFAULT_CLIENT_VERSION)
54
+ .merge(normalized)
55
+
56
+ multipart_request(payload, file)
51
57
  end
52
58
 
53
59
  private
@@ -101,11 +107,11 @@ module Ruby
101
107
  def build_multipart_body(params, file, boundary)
102
108
  parts = []
103
109
 
104
- params.each do |key, value|
105
- parts << "--#{boundary}\r\n" \
106
- "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n" \
107
- "#{value}\r\n"
108
- end
110
+ # Send all params as a single JSON field named "data"
111
+ parts << "--#{boundary}\r\n" \
112
+ "Content-Disposition: form-data; name=\"data\"\r\n" \
113
+ "Content-Type: text/plain;charset=utf-8\r\n\r\n" \
114
+ "#{JSON.generate(params)}\r\n"
109
115
 
110
116
  if file
111
117
  filename = file.respond_to?(:path) ? File.basename(file.path) : "upload"
@@ -4,7 +4,7 @@ module Ruby
4
4
  module Fiix
5
5
  module Cmms
6
6
  module Client
7
- VERSION = "0.1.0"
7
+ VERSION = "0.1.1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-fiix-cmms-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronald Langeveld