tofulcrum 0.0.9 → 0.0.10

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: a68e8c5c982398ee78373d7dd468a82beaf4a895
4
- data.tar.gz: 2c14b9b22084c4c8b13e62f5999040d18fa3c742
3
+ metadata.gz: 4cdccba628f7783f1ded38335699b0a770e1bba2
4
+ data.tar.gz: f060e5eee7c99b3dd3a4c3a2047336f9699e2c5a
5
5
  SHA512:
6
- metadata.gz: cddb2b6b3d5950c8892f2ac2cf6ff9a44aa7325a98bc253954110eb18bc0d93a49c9b214c19e5259a285afdd271896b95c3aba4205e39ba495d29a647ce0ea69
7
- data.tar.gz: f4e77446631aae67b4130fe920a720dddad74bd54e70ca66cd8787db01a2abd22cce43e8ba77eed42b8644d7d8eefa72a8a934df7ab37b2e8cbd37e80087fc69
6
+ metadata.gz: a533b713128d20206f4ac0c21ed85459960b8ef3bb73a3c53a8134f84e7d46b3acbc3098fb0354bd22770d27ee3b1fad1d300ba20a60747c9eba542cd8745c30
7
+ data.tar.gz: adf26f956fbc31d4b5863d58d1ee2dcc038957a74e8c1259da52630528265ccadabca19e3cbd847eab3fcde588fbe92d32b5a7bdb4142baffe7ec3d0a0b3eedd
@@ -11,7 +11,8 @@ module Fulcrum
11
11
  'date',
12
12
  'address',
13
13
  'signature',
14
- 'photos'
14
+ 'photos',
15
+ 'label'
15
16
  ]
16
17
 
17
18
  def self.read(file)
@@ -93,9 +94,12 @@ module Fulcrum
93
94
  hash[:elements] = [] if %w(Section Repeatable).include?(hash[:type])
94
95
  hash[:key] = SecureRandom.hex(2)
95
96
 
96
- if hash[:type] == 'ChoiceField'
97
+ case hash[:type]
98
+ when 'ChoiceField'
97
99
  hash[:choices] = @choices[row['choices']] if hash[:type] == 'ChoiceField'
98
100
  hash[:allow_other] = boolean_value(row[:allow_other])
101
+ when 'AddressField'
102
+ hash[:auto_populate] = boolean_value(row[:auto_populate], true)
99
103
  end
100
104
  end
101
105
  end
@@ -121,6 +125,7 @@ module Fulcrum
121
125
  when 'address' then 'AddressField'
122
126
  when 'signature' then 'SignatureField'
123
127
  when 'photos' then 'PhotoField'
128
+ when 'label' then 'Label'
124
129
  else nil
125
130
  end
126
131
  end
@@ -1,3 +1,3 @@
1
1
  module Tofulcrum
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/tofulcrum.rb CHANGED
@@ -55,6 +55,16 @@ module Tofulcrum
55
55
  case map[:field]['type']
56
56
  when 'ChoiceField'
57
57
  value = { choice_values: row[map[:index]].split(',').map(&:strip) } rescue nil
58
+ when 'PhotoField'
59
+ value = []
60
+ row[map[:index]].split(',').map(&:strip).each do |photo|
61
+ if File.exist?(photo)
62
+ key = SecureRandom.uuid
63
+ file = File.open(photo)
64
+ Fulcrum::Photo.create(file, "image/jpeg", key, "")
65
+ value << { "photo_id" => key }
66
+ end
67
+ end
58
68
  else
59
69
  value = row[map[:index]]
60
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tofulcrum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac McCormick