to_google_spreadsheet 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -63,6 +63,37 @@ end
63
63
 
64
64
  The first argument being the name of the worksheet within the spreadsheet, e.g. "Accounts", if it doesn't already exist, it will be created. The second, optional, argument is the spreadsheet key (see Obtaining your spreadsheet key above), if it is not supplied, the default spreadsheet, defined by in the configuration will be used.
65
65
 
66
+ ### Examples
67
+
68
+ ```ruby
69
+ # Configure
70
+ GoogleSpreadsheet.config do |c|
71
+ c.email = "user@company.com"
72
+ c.password = "seekrit"
73
+
74
+ # optional, see note below on how to obtain a spreadsheet key
75
+ c.default_spreadsheet = "spreadsheet_key"
76
+ end
77
+
78
+ # Populates the worksheet "Employees" in the default spreadsheet
79
+ # with two employees
80
+ [
81
+ {:name => "Bob", :age => 26},
82
+ {:name => "John", :age => 28}
83
+ ].to_google_spreadsheet("Employees")
84
+
85
+ # Populates the worksheet "Signups" in the nondefault spreadsheet
86
+ # with two signup dates
87
+ [
88
+ {:date => "18/7/2011", :signups => 28},
89
+ {:date => "19/7/2011", :signups => 33}
90
+ ].to_google_spreadsheet("Signups", "other_spreadsheet_key")
91
+
92
+ # Populates the worksheet "Accounts" in the default spreadsheet
93
+ # with all # accounts in the database
94
+ Account.all.to_google_spreadsheet("Accounts")
95
+ ```
96
+
66
97
  ## Supported objects
67
98
 
68
99
  ```ruby
@@ -61,7 +61,12 @@ module GoogleSpreadsheet
61
61
  end
62
62
 
63
63
  module Enumerable
64
- def to_google_spreadsheet(worksheet, spreadsheet = GoogleSpreadsheet::Config.default_spreadsheet)
64
+ def to_google_spreadsheet(worksheet, spreadsheet = nil)
65
+ # We do this explicityly instead of using the default_spreadsheet as default
66
+ # in the parameters since we want to let people pass nil to indicate they
67
+ # want to use the default spreadsheet.
68
+ spreadsheet = GoogleSpreadsheet::Config.default_spreadsheet unless spreadsheet
69
+
65
70
  session = GoogleSpreadsheet.login(GoogleSpreadsheet::Config.email,
66
71
  GoogleSpreadsheet::Config.password)
67
72
  spreadsheet = session.spreadsheet_by_key(spreadsheet)
@@ -1,3 +1,3 @@
1
1
  module ToGoogleSpreadsheet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,50 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: to_google_spreadsheet
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
4
5
  prerelease:
5
- version: 0.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Simon H. Eskildsen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-03 00:00:00 +02:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-20 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: google-spreadsheet-ruby
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70181453937120 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70181453937120
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70181453936620 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
36
33
  type: :development
37
- version_requirements: *id002
38
- description: Convert an Array where Array.all? {|e| [OpenStruct,Hash,ActiveRecord::Base].any? { |type| e.kind_of?(type) }} to a Google spreadsheet
39
- email:
34
+ prerelease: false
35
+ version_requirements: *70181453936620
36
+ description: Convert an Array where Array.all? {|e| [OpenStruct,Hash,ActiveRecord::Base].any?
37
+ { |type| e.kind_of?(type) }} to a Google spreadsheet
38
+ email:
40
39
  - sirup@sirupsen.com
41
40
  executables: []
42
-
43
41
  extensions: []
44
-
45
42
  extra_rdoc_files: []
46
-
47
- files:
43
+ files:
48
44
  - .gitignore
49
45
  - .rspec
50
46
  - Gemfile
@@ -54,33 +50,30 @@ files:
54
50
  - lib/to_google_spreadsheet/version.rb
55
51
  - test/test.rb
56
52
  - to_google_spreadsheet.gemspec
57
- has_rdoc: true
58
53
  homepage: https://github.com/firmafon/to_google_spreadsheet
59
54
  licenses: []
60
-
61
55
  post_install_message:
62
56
  rdoc_options: []
63
-
64
- require_paths:
57
+ require_paths:
65
58
  - lib
66
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
67
60
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: "0"
72
- required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
66
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
78
71
  requirements: []
79
-
80
72
  rubyforge_project: to_google_spreadsheet
81
- rubygems_version: 1.6.2
73
+ rubygems_version: 1.8.10
82
74
  signing_key:
83
75
  specification_version: 3
84
- summary: Convert an Array where Array.all? {|e| [OpenStruct,Hash,ActiveRecord::Base].any? { |type| e.kind_of?(type) }} to a Google spreadsheet
85
- test_files:
76
+ summary: Convert an Array where Array.all? {|e| [OpenStruct,Hash,ActiveRecord::Base].any?
77
+ { |type| e.kind_of?(type) }} to a Google spreadsheet
78
+ test_files:
86
79
  - test/test.rb