Floppy-amee 0.4.6 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amee/drill_down.rb +15 -2
- data/lib/amee/profile_category.rb +2 -2
- data/lib/amee/version.rb +1 -1
- metadata +2 -2
data/lib/amee/drill_down.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
module AMEE
|
2
4
|
module Data
|
3
5
|
class DrillDown < AMEE::Data::Object
|
@@ -25,9 +27,9 @@ module AMEE
|
|
25
27
|
def choose(choice)
|
26
28
|
options = []
|
27
29
|
@selections.each_pair do |key, value|
|
28
|
-
options << "#{key}=#{value}"
|
30
|
+
options << "#{CGI::escape(key)}=#{CGI::escape(value)}"
|
29
31
|
end
|
30
|
-
options << "#{@choice_name}=#{choice}"
|
32
|
+
options << "#{CGI::escape(@choice_name)}=#{CGI::escape(choice)}"
|
31
33
|
query_string = options.join "&"
|
32
34
|
DrillDown.get(connection, "#{full_path}?#{query_string}")
|
33
35
|
end
|
@@ -36,6 +38,17 @@ module AMEE
|
|
36
38
|
# Parse json
|
37
39
|
doc = JSON.parse(json)
|
38
40
|
data = {}
|
41
|
+
data[:choice_name] = doc['choices']['name']
|
42
|
+
choices = []
|
43
|
+
doc['choices']['choices'].each do |c|
|
44
|
+
choices << c['value']
|
45
|
+
end
|
46
|
+
data[:choices] = choices
|
47
|
+
selections = {}
|
48
|
+
doc['selections'].each do |c|
|
49
|
+
selections[c['name']] = c['value']
|
50
|
+
end
|
51
|
+
data[:selections] = selections
|
39
52
|
# Create object
|
40
53
|
DrillDown.new(data)
|
41
54
|
rescue
|
@@ -145,8 +145,8 @@ module AMEE
|
|
145
145
|
AMEE::Profile::Category.get(connection, "#{full_path}/#{child_path}")
|
146
146
|
end
|
147
147
|
|
148
|
-
def item(
|
149
|
-
item = items.find{ |x| x[:dataItemLabel] ==
|
148
|
+
def item(label_or_uid)
|
149
|
+
item = items.find{ |x| x[:dataItemLabel] == label_or_uid || x[:dataItemUid] == label_or_uid}
|
150
150
|
item ? AMEE::Profile::Item.get(connection, "#{full_path}/#{item[:path]}") : nil
|
151
151
|
end
|
152
152
|
|
data/lib/amee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Floppy-amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|