gfrom 0.1.6 → 0.1.7
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.
- data/gfrom.gemspec +2 -2
- data/lib/gfrom.rb +4 -3
- data/readme.md +14 -7
- metadata +2 -4
data/gfrom.gemspec
CHANGED
@@ -5,10 +5,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.platform = Gem::Platform::RUBY
|
7
7
|
spec.name = "gfrom"
|
8
|
-
spec.version = "0.1.
|
8
|
+
spec.version = "0.1.7"
|
9
9
|
spec.authors = ["Marvin Marcelo"]
|
10
10
|
spec.email = ["mrclmrvn@gmail.com"]
|
11
|
-
spec.description = %q{
|
11
|
+
spec.description = %q{Wrap Google Form within your site}
|
12
12
|
spec.summary = %q{From Google Form}
|
13
13
|
spec.homepage = "https://bitbucket.org/mrclmrvn/gfrom/"
|
14
14
|
spec.license = "MIT"
|
data/lib/gfrom.rb
CHANGED
@@ -47,9 +47,10 @@ class Gfrom
|
|
47
47
|
doc = Nokogiri::XML.parse(response.body_str)
|
48
48
|
errorheader = doc.search('//div[@class="errorheader"]')
|
49
49
|
success = errorheader.empty?
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
out = { :success => success }
|
51
|
+
if success
|
52
|
+
out[:message] = doc.search('//div[@class="ss-custom-resp"]').first.text.strip rescue doc.search('//title').first.text.strip
|
53
|
+
else
|
53
54
|
out[:message] = errorheader.children.first.text.strip
|
54
55
|
end
|
55
56
|
out
|
data/readme.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Gfrom (From Google Form)
|
2
2
|
|
3
|
-
|
3
|
+
Wrap Google Form in your website. Useful for collecting data from your users without a database, and if you hate country restrictions of the form services out there. Plus you can style it your on way.
|
4
|
+
|
5
|
+
Just create a form from your google account and copy the published URL. If you are using Google Apps, please read [form options](http://support.google.com/drive/bin/answer.py?hl=en&answer=160166), make sure `require sign-in` is unchecked.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -25,11 +27,17 @@ GOOGLE_FORM_URL = "https://docs.google.com/a/myorganization.com/spreadsheet/embe
|
|
25
27
|
@myform = Gfrom.new(GOOGLE_FORM_URL)
|
26
28
|
# fields are stored in array of hashes
|
27
29
|
# @fields=[
|
28
|
-
# {:element=>"input", :type=>"text", :name=>"entry.
|
29
|
-
# {:element=>"input", :type=>"text", :name=>"entry.
|
30
|
-
# {:element=>"
|
31
|
-
# {:element=>"input", :type=>"
|
32
|
-
# {:element=>"input", :type=>"
|
30
|
+
# {:element=>"input", :type=>"text", :name=>"entry.479273699", :value=>"", :class=>"ss-q-short", :id=>"entry_479273699", :label=>"First name\n\n*", :dir=>"auto", :"aria-required"=>"true"},
|
31
|
+
# {:element=>"input", :type=>"text", :name=>"entry.372120214", :value=>"", :class=>"ss-q-short", :id=>"entry_372120214", :label=>"Last name\n\n*", :dir=>"auto", :"aria-required"=>"true"},
|
32
|
+
# {:element=>"input", :type=>"text", :name=>"entry.1874514893", :value=>"", :class=>"ss-q-short", :id=>"entry_1874514893", :label=>"Middle name", :dir=>"auto"},
|
33
|
+
# {:element=>"input", :type=>"radio", :label=>"Male", :name=>"entry.1593861918", :value=>"Male", :id=>"group_1593861918_1", :class=>"ss-q-radio", :"aria-label"=>"Male"},
|
34
|
+
# {:element=>"input", :type=>"radio", :label=>"Female", :name=>"entry.1593861918", :value=>"Female", :id=>"group_1593861918_2", :class=>"ss-q-radio", :"aria-label"=>"Female"},
|
35
|
+
# {:element=>"input", :type=>"checkbox", :label=>"Ruby", :name=>"entry.299194237[]", :value=>"Ruby", :id=>"group_299194237_1", :class=>"ss-q-checkbox"},
|
36
|
+
# {:element=>"input", :type=>"checkbox", :label=>"PHP", :name=>"entry.299194237[]", :value=>"PHP", :id=>"group_299194237_2", :class=>"ss-q-checkbox"},
|
37
|
+
# {:element=>"input", :type=>"checkbox", :label=>"Django", :name=>"entry.299194237[]", :value=>"Django", :id=>"group_299194237_3", :class=>"ss-q-checkbox"},
|
38
|
+
# {:element=>"input", :type=>"checkbox", :label=>"Python", :name=>"entry.299194237[]", :value=>"Python", :id=>"group_299194237_4", :class=>"ss-q-checkbox"},
|
39
|
+
# {:element=>"input", :type=>"hidden", :name=>"draftResponse", :value=>"[] "},
|
40
|
+
# {:element=>"input", :type=>"hidden", :name=>"pageHistory", :value=>"0"}
|
33
41
|
# ]
|
34
42
|
puts @myform.fields
|
35
43
|
# submit the form data to Google will return a hash
|
@@ -41,7 +49,6 @@ result = @myform.submit(params)
|
|
41
49
|
## TODO
|
42
50
|
|
43
51
|
* Support for Authenticated forms (requires login to organization/google apps)
|
44
|
-
* ~~Ensure radio buttons and checkboxes are grouped (not sure if this works in current version - 0.1.2)~~
|
45
52
|
* Label for grouped form tags - checkbox and radio
|
46
53
|
* Supply an RDOC
|
47
54
|
* Tests
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfrom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -91,9 +91,7 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
-
description:
|
95
|
-
data from your users without a database. Just create a google form from your google
|
96
|
-
account. If you are using Google Apps, please read form options
|
94
|
+
description: Wrap Google Form within your site
|
97
95
|
email:
|
98
96
|
- mrclmrvn@gmail.com
|
99
97
|
executables: []
|