sheet_mapper 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f12d8b4314a6dc93f71ffdb24ec7539013bf492
4
+ data.tar.gz: 5d39c055124f86dfef968581ab1b5740891a3f36
5
+ SHA512:
6
+ metadata.gz: 2b22b600b938ae02d9f3e2c2877225b07edfab2f843ec12b0e7de5da18833b5bf47ea3859d72b1d29316997a7fb7a7041f6161defea9ba6feadd33240549d261
7
+ data.tar.gz: 7a16ac180735b6c9381b5085704c67fdb21b7861f4d4b0eac3711bc8b5308fa95e5c025bd62367c322c56e5217c080f35a19f0da94b1589e9873c70711841ec1
@@ -4,7 +4,10 @@ rvm:
4
4
  - 1.8.7
5
5
  - 1.9.2
6
6
  - 1.9.3
7
- - rbx
7
+ - rbx-19mode
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: 1.8.7
8
11
  notifications:
9
12
  recipients:
10
13
  - nesquena@gmail.com
@@ -2,7 +2,7 @@ $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  require 'core_ext/hash_ext' unless Hash.method_defined?(:symbolize_keys)
4
4
  require 'core_ext/object_ext' unless Object.method_defined?(:present?)
5
- require 'google_spreadsheet'
5
+ require 'google_drive'
6
6
  require 'sheet_mapper/version'
7
7
  require 'sheet_mapper/collection'
8
8
  require 'sheet_mapper/spreadsheet'
@@ -5,8 +5,8 @@ module SheetMapper
5
5
  # SheetMapper::Worksheet.new(:mapper => SomeMapper, :key => 'sheet_key', :login => 'user', :password => 'pass')
6
6
  def initialize(options={})
7
7
  @mapper = options[:mapper]
8
- @session = ::GoogleSpreadsheet.login(options[:login], options[:password])
9
- @spreadsheet = @session.spreadsheet_by_key(options[:key])
8
+ @session = ::GoogleDrive.login(options[:login], options[:password])
9
+ @spreadsheet = find_spreadsheet(options[:key], options[:url], options[:title])
10
10
  end
11
11
 
12
12
  # Returns the first worksheet with given title
@@ -17,5 +17,14 @@ module SheetMapper
17
17
  raise CollectionNotFound, "No worksheet found '#{val}'! Please try again." unless worksheet
18
18
  Collection.new(self, worksheet)
19
19
  end
20
+
21
+ private
22
+ def find_spreadsheet(key, url, title)
23
+ raise ArgumentError, "No key, url or title specified for the spreadsheet" unless key || url || title
24
+ return @session.spreadsheet_by_url(url) if url
25
+ return @session.spreadsheet_by_title(title) if title
26
+ @session.spreadsheet_by_key(key)
27
+ end
28
+
20
29
  end
21
30
  end
@@ -1,3 +1,3 @@
1
1
  module SheetMapper
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency 'google-spreadsheet-ruby', '~> 0.2.1'
21
+ s.add_dependency 'google_drive', '>= 0.3.6'
22
22
 
23
23
  s.add_development_dependency 'minitest', "~> 2.11.0"
24
24
  s.add_development_dependency 'rake'
@@ -4,28 +4,26 @@ describe "Spreadsheet" do
4
4
  setup do
5
5
  @sheet_stub = stub(:sheet)
6
6
  @session_stub = stub(:session)
7
- @session_stub.expects(:spreadsheet_by_key).with('foo').returns(@sheet_stub)
8
- ::GoogleSpreadsheet.expects(:login).with('login', 'pass').returns(@session_stub)
7
+ ::GoogleDrive.expects(:login).with('login', 'pass').returns(@session_stub)
9
8
  end
10
9
 
11
- context "for initialize" do
12
- setup do
13
- @sheet = SheetMapper::Spreadsheet.new(:mapper => Object, :key => 'foo', :login => 'login', :password => 'pass')
14
- end
10
+ [:key, :url, :title].each do |identifier|
11
+ context "for initialize by #{identifier}" do
12
+ setup do
13
+ @session_stub.expects(:"spreadsheet_by_#{identifier}").with('foo').returns(@sheet_stub)
14
+ @sheet = SheetMapper::Spreadsheet.new(:mapper => Object, identifier => 'foo', :login => 'login', :password => 'pass')
15
+ end
15
16
 
16
- should "return spreadsheet class" do
17
- assert_kind_of SheetMapper::Spreadsheet, @sheet
18
- end
17
+ should "not return spreadsheet class" do
18
+ assert_kind_of SheetMapper::Spreadsheet, @sheet
19
+ end
19
20
 
20
- should "have access to readers" do
21
- assert_equal Object, @sheet.mapper
22
- assert_equal @session_stub, @sheet.session
23
- assert_equal @sheet_stub, @sheet.spreadsheet
24
- end
25
- end # initialize
21
+ end # initialize
22
+ end
26
23
 
27
24
  context "for find_collection_by_title method" do
28
25
  setup do
26
+ @session_stub.expects(:spreadsheet_by_key).with('foo').returns(@sheet_stub)
29
27
  @sheet = SheetMapper::Spreadsheet.new(:mapper => Object, :key => 'foo', :login => 'login', :password => 'pass')
30
28
  @work_stub = stub(:worksheet)
31
29
  @work_stub.expects(:title).returns("FOO")
metadata CHANGED
@@ -1,120 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sheet_mapper
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Nathan Esquenazi
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-08-07 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: google-spreadsheet-ruby
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 21
29
- segments:
30
- - 0
31
- - 2
32
- - 1
33
- version: 0.2.1
11
+ date: 2013-09-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google_drive
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.6
34
20
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: minitest
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
42
31
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 35
45
- segments:
46
- - 2
47
- - 11
48
- - 0
32
+ - !ruby/object:Gem::Version
49
33
  version: 2.11.0
50
34
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rake
54
35
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 2.11.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
64
48
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: mocha
68
49
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mocha
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
78
62
  type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: fakeweb
82
63
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakeweb
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
92
76
  type: :development
93
- version_requirements: *id005
94
- - !ruby/object:Gem::Dependency
95
- name: awesome_print
96
77
  prerelease: false
97
- requirement: &id006 !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: awesome_print
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
106
90
  type: :development
107
- version_requirements: *id006
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
108
97
  description: Map google spreadsheets to ruby objects.
109
- email:
98
+ email:
110
99
  - nesquena@gmail.com
111
100
  executables: []
112
-
113
101
  extensions: []
114
-
115
102
  extra_rdoc_files: []
116
-
117
- files:
103
+ files:
118
104
  - .gitignore
119
105
  - .travis.yml
120
106
  - Gemfile
@@ -135,42 +121,33 @@ files:
135
121
  - test/spreadsheet_test.rb
136
122
  - test/test_config.rb
137
123
  - test/test_helpers/mini_shoulda.rb
138
- homepage: ""
124
+ homepage: ''
139
125
  licenses: []
140
-
126
+ metadata: {}
141
127
  post_install_message:
142
128
  rdoc_options: []
143
-
144
- require_paths:
129
+ require_paths:
145
130
  - lib
146
- required_ruby_version: !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- hash: 3
152
- segments:
153
- - 0
154
- version: "0"
155
- required_rubygems_version: !ruby/object:Gem::Requirement
156
- none: false
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- hash: 3
161
- segments:
162
- - 0
163
- version: "0"
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
164
141
  requirements: []
165
-
166
142
  rubyforge_project: sheet_mapper
167
- rubygems_version: 1.8.21
143
+ rubygems_version: 2.0.6
168
144
  signing_key:
169
- specification_version: 3
145
+ specification_version: 4
170
146
  summary: Map google spreadsheets to ruby objects
171
- test_files:
147
+ test_files:
172
148
  - test/base_test.rb
173
149
  - test/collection_test.rb
174
150
  - test/spreadsheet_test.rb
175
151
  - test/test_config.rb
176
152
  - test/test_helpers/mini_shoulda.rb
153
+ has_rdoc: