google-ft 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +74 -0
  2. data/google-ft.gemspec +2 -2
  3. metadata +5 -5
data/README.md CHANGED
@@ -2,3 +2,77 @@ google_ft
2
2
  ===============
3
3
 
4
4
  Google Fusion Tables API for ruby.
5
+
6
+ ```ruby
7
+ require 'google-ft'
8
+
9
+ # Create a new GoogleFT instance.
10
+ fusion_tables = GoogleFT.new
11
+
12
+ # Get the authorization token (must be service account)
13
+ puts "Getting authorization token."
14
+ token = fusion_tables.get_auth_token(
15
+ :email_address => 'youraddress@developer.gserviceaccount.com',
16
+ :scope => ['fusiontables','drive'],
17
+ :key => File.read('/path/to/yourprivatekeyfromgoogle.p12'),
18
+ :password => 'notasecret'
19
+ ).token_string
20
+ puts "Token: #{token}"
21
+
22
+ # Create a table.
23
+ puts "Creating a table."
24
+ table = fusion_tables.create_table(
25
+ :name => 'NewMap1',
26
+ :columns => [
27
+ {
28
+ :name => 'TestColumn1',
29
+ :type => 'string'
30
+ },
31
+ {
32
+ :name => 'TestColumn2',
33
+ :type => 'number'
34
+ },
35
+ {
36
+ :name => 'IPLocation',
37
+ :type => 'location'
38
+ }
39
+ ],
40
+ :description => 'This is a test.',
41
+ :exportable => true
42
+ )
43
+ puts "Table ID: #{table.id}"
44
+
45
+ # Get a table by ID.
46
+ puts "Getting table by ID."
47
+ table = fusion_tables.get_table(table.id)
48
+ puts "Table: #{table.post_args}"
49
+
50
+ # Create a new permission for the table.
51
+ puts "Creating permissions for table."
52
+ permissions = GoogleFT::Table::Permission.new(
53
+ :role => 'reader',
54
+ :type => 'anyone',
55
+ :value => 'me',
56
+ :require_link => true
57
+ )
58
+ table.set_permissions(permissions)
59
+
60
+ # Insert some rows into the table.
61
+ puts "Inserting rows."
62
+ begin
63
+ puts table.insert([
64
+ {'TestColumn1' => 'This is row 1 column 1', 'TestColumn2' => 10, 'IPLocation' => [0.00, 0.00]},
65
+ {'TestColumn1' => "Testing a row with tricky characters: ; ? \\ & ' \\' \n", 'TestColumn2' => 20, 'IPLocation' => [-4.034,4.035]},
66
+ {'TestColumn1' => 'Bar', 'TestColumn2' => 30, 'IPLocation' => [10.0, -10.0]}
67
+ ])
68
+ rescue => e
69
+ puts "Error: #{e}"
70
+ end
71
+
72
+ # Show all tables.
73
+ puts "All tables"
74
+ tables = fusion_tables.show_tables
75
+
76
+ # Delete this table.
77
+ #puts "Deleting table: #{table.delete}"
78
+ ```
@@ -3,10 +3,10 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "google-ft"
6
- s.version = "0.0.3"
6
+ s.version = "0.0.4"
7
7
  s.authors = ["Jon Durbin"]
8
8
  s.email = ["jond@greenviewdata.com"]
9
- s.homepage = "https://github.com/gdi/google-ft"
9
+ s.homepage = "https://github.com/jondurbin/google-ft"
10
10
  s.summary = %q{Work with Google Fusion Tables using a service account}
11
11
  s.description = %q{Work with Google Fusion Tables using a service account}
12
12
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-ft
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jon Durbin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-07 00:00:00 -05:00
18
+ date: 2012-12-13 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -93,7 +93,7 @@ files:
93
93
  - lib/google-ft/table/column.rb
94
94
  - lib/google-ft/table/permission.rb
95
95
  has_rdoc: true
96
- homepage: https://github.com/gdi/google-ft
96
+ homepage: https://github.com/jondurbin/google-ft
97
97
  licenses: []
98
98
 
99
99
  post_install_message: