advantage_quickbase 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/quickbase.rb +11 -4
- metadata +2 -2
data/lib/quickbase.rb
CHANGED
@@ -243,7 +243,8 @@ module AdvantageQuickbase
|
|
243
243
|
end
|
244
244
|
|
245
245
|
new_values = new_values.map do |field_id, value|
|
246
|
-
|
246
|
+
# Values that are hashes with name and file are encoded seperately
|
247
|
+
if value.is_a?( Hash ) && value.length == 2 && value[:name] && value[:file]
|
247
248
|
file = encode_file( value[:file] )
|
248
249
|
"<field fid='#{field_id}' filename='#{value[:name]}'>#{file}</field>"
|
249
250
|
else
|
@@ -256,9 +257,15 @@ module AdvantageQuickbase
|
|
256
257
|
xml += '</qdbapi>'
|
257
258
|
end
|
258
259
|
|
259
|
-
def encode_file
|
260
|
-
|
261
|
-
|
260
|
+
def encode_file( path_or_content )
|
261
|
+
# File accepts either file content or a file path
|
262
|
+
if File.file?( path_or_content )
|
263
|
+
file_content = File.open(path_or_content, 'rb') { |f| f.read }
|
264
|
+
else
|
265
|
+
file_content = path_or_content
|
266
|
+
end
|
267
|
+
|
268
|
+
Base64.strict_encode64( file_content )
|
262
269
|
end
|
263
270
|
|
264
271
|
def build_csv_xml( new_values, fields_to_import )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: advantage_quickbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|