google-api-client 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/google/api_client/discovery/api.rb +10 -10
- data/lib/google/api_client/discovery/resource.rb +10 -10
- data/lib/google/api_client/discovery/schema.rb +8 -6
- data/lib/google/api_client/version.rb +1 -1
- data/spec/google/api_client/discovery_spec.rb +0 -1
- data/spec/google/api_client_spec.rb +0 -1
- data/tasks/gem.rake +3 -3
- metadata +7 -7
data/CHANGELOG.md
CHANGED
@@ -44,13 +44,13 @@ module Google
|
|
44
44
|
@document_base = Addressable::URI.parse(document_base)
|
45
45
|
@discovery_document = discovery_document
|
46
46
|
metaclass = (class <<self; self; end)
|
47
|
-
self.
|
47
|
+
self.discovered_resources.each do |resource|
|
48
48
|
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
|
49
49
|
if !self.respond_to?(method_name)
|
50
50
|
metaclass.send(:define_method, method_name) { resource }
|
51
51
|
end
|
52
52
|
end
|
53
|
-
self.
|
53
|
+
self.discovered_methods.each do |method|
|
54
54
|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
|
55
55
|
if !self.respond_to?(method_name)
|
56
56
|
metaclass.send(:define_method, method_name) { method }
|
@@ -164,10 +164,10 @@ module Google
|
|
164
164
|
# The new base URI to use for the service.
|
165
165
|
def method_base=(new_method_base)
|
166
166
|
@method_base = Addressable::URI.parse(new_method_base)
|
167
|
-
self.
|
167
|
+
self.discovered_resources.each do |resource|
|
168
168
|
resource.method_base = @method_base
|
169
169
|
end
|
170
|
-
self.
|
170
|
+
self.discovered_methods.each do |method|
|
171
171
|
method.method_base = @method_base
|
172
172
|
end
|
173
173
|
end
|
@@ -207,8 +207,8 @@ module Google
|
|
207
207
|
# API.
|
208
208
|
#
|
209
209
|
# @return [Array] A list of {Google::APIClient::Resource} objects.
|
210
|
-
def
|
211
|
-
return @
|
210
|
+
def discovered_resources
|
211
|
+
return @discovered_resources ||= (
|
212
212
|
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
|
213
213
|
accu << Google::APIClient::Resource.new(
|
214
214
|
self, self.method_base, k, v
|
@@ -223,8 +223,8 @@ module Google
|
|
223
223
|
# API.
|
224
224
|
#
|
225
225
|
# @return [Array] A list of {Google::APIClient::Method} objects.
|
226
|
-
def
|
227
|
-
return @
|
226
|
+
def discovered_methods
|
227
|
+
return @discovered_methods ||= (
|
228
228
|
(@discovery_document['methods'] || []).inject([]) do |accu, (k, v)|
|
229
229
|
accu << Google::APIClient::Method.new(self, self.method_base, k, v)
|
230
230
|
accu
|
@@ -249,10 +249,10 @@ module Google
|
|
249
249
|
def to_h
|
250
250
|
return @hash ||= (begin
|
251
251
|
methods_hash = {}
|
252
|
-
self.
|
252
|
+
self.discovered_methods.each do |method|
|
253
253
|
methods_hash[method.id] = method
|
254
254
|
end
|
255
|
-
self.
|
255
|
+
self.discovered_resources.each do |resource|
|
256
256
|
methods_hash.merge!(resource.to_h)
|
257
257
|
end
|
258
258
|
methods_hash
|
@@ -42,13 +42,13 @@ module Google
|
|
42
42
|
@name = resource_name
|
43
43
|
@discovery_document = discovery_document
|
44
44
|
metaclass = (class <<self; self; end)
|
45
|
-
self.
|
45
|
+
self.discovered_resources.each do |resource|
|
46
46
|
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
|
47
47
|
if !self.respond_to?(method_name)
|
48
48
|
metaclass.send(:define_method, method_name) { resource }
|
49
49
|
end
|
50
50
|
end
|
51
|
-
self.
|
51
|
+
self.discovered_methods.each do |method|
|
52
52
|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
|
53
53
|
if !self.respond_to?(method_name)
|
54
54
|
metaclass.send(:define_method, method_name) { method }
|
@@ -82,10 +82,10 @@ module Google
|
|
82
82
|
# The new base URI to use for the resource.
|
83
83
|
def method_base=(new_method_base)
|
84
84
|
@method_base = Addressable::URI.parse(new_method_base)
|
85
|
-
self.
|
85
|
+
self.discovered_resources.each do |resource|
|
86
86
|
resource.method_base = @method_base
|
87
87
|
end
|
88
|
-
self.
|
88
|
+
self.discovered_methods.each do |method|
|
89
89
|
method.method_base = @method_base
|
90
90
|
end
|
91
91
|
end
|
@@ -94,8 +94,8 @@ module Google
|
|
94
94
|
# A list of sub-resources available on this resource.
|
95
95
|
#
|
96
96
|
# @return [Array] A list of {Google::APIClient::Resource} objects.
|
97
|
-
def
|
98
|
-
return @
|
97
|
+
def discovered_resources
|
98
|
+
return @discovered_resources ||= (
|
99
99
|
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
|
100
100
|
accu << Google::APIClient::Resource.new(
|
101
101
|
@api, self.method_base, k, v
|
@@ -109,8 +109,8 @@ module Google
|
|
109
109
|
# A list of methods available on this resource.
|
110
110
|
#
|
111
111
|
# @return [Array] A list of {Google::APIClient::Method} objects.
|
112
|
-
def
|
113
|
-
return @
|
112
|
+
def discovered_methods
|
113
|
+
return @discovered_methods ||= (
|
114
114
|
(@discovery_document['methods'] || []).inject([]) do |accu, (k, v)|
|
115
115
|
accu << Google::APIClient::Method.new(@api, self.method_base, k, v)
|
116
116
|
accu
|
@@ -126,10 +126,10 @@ module Google
|
|
126
126
|
def to_h
|
127
127
|
return @hash ||= (begin
|
128
128
|
methods_hash = {}
|
129
|
-
self.
|
129
|
+
self.discovered_methods.each do |method|
|
130
130
|
methods_hash[method.id] = method
|
131
131
|
end
|
132
|
-
self.
|
132
|
+
self.discovered_resources.each do |resource|
|
133
133
|
methods_hash.merge!(resource.to_h)
|
134
134
|
end
|
135
135
|
methods_hash
|
@@ -74,20 +74,22 @@ module Google
|
|
74
74
|
Google::INFLECTOR.camelize(api.name)
|
75
75
|
api_version_string =
|
76
76
|
Google::INFLECTOR.camelize(api.version).gsub('.', '_')
|
77
|
-
if Google::APIClient::Schema.const_defined?(api_name_string)
|
78
|
-
api_name = Google::APIClient::Schema.const_get(
|
77
|
+
if Google::APIClient::Schema.const_defined?(api_name_string, false)
|
78
|
+
api_name = Google::APIClient::Schema.const_get(
|
79
|
+
api_name_string, false
|
80
|
+
)
|
79
81
|
else
|
80
82
|
api_name = Google::APIClient::Schema.const_set(
|
81
83
|
api_name_string, Module.new
|
82
84
|
)
|
83
85
|
end
|
84
|
-
if api_name.const_defined?(api_version_string)
|
85
|
-
api_version = api_name.const_get(api_version_string)
|
86
|
+
if api_name.const_defined?(api_version_string, false)
|
87
|
+
api_version = api_name.const_get(api_version_string, false)
|
86
88
|
else
|
87
89
|
api_version = api_name.const_set(api_version_string, Module.new)
|
88
90
|
end
|
89
|
-
if api_version.const_defined?(schema_name)
|
90
|
-
schema_class = api_version.const_get(schema_name)
|
91
|
+
if api_version.const_defined?(schema_name, false)
|
92
|
+
schema_class = api_version.const_get(schema_name, false)
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
@@ -23,7 +23,6 @@ require 'signet/oauth_1/client'
|
|
23
23
|
|
24
24
|
require 'google/api_client'
|
25
25
|
require 'google/api_client/version'
|
26
|
-
require 'google/api_client/parsers/json_parser'
|
27
26
|
|
28
27
|
shared_examples_for 'configurable user agent' do
|
29
28
|
it 'should allow the user agent to be modified' do
|
data/tasks/gem.rake
CHANGED
@@ -24,9 +24,9 @@ namespace :gem do
|
|
24
24
|
s.rdoc_options.concat ['--main', 'README.md']
|
25
25
|
|
26
26
|
# Dependencies used in the main library
|
27
|
-
s.add_runtime_dependency('signet', '
|
28
|
-
s.add_runtime_dependency('addressable', '
|
29
|
-
s.add_runtime_dependency('autoparse', '
|
27
|
+
s.add_runtime_dependency('signet', '>= 0.3.1')
|
28
|
+
s.add_runtime_dependency('addressable', '>= 2.2.3')
|
29
|
+
s.add_runtime_dependency('autoparse', '>= 0.3.1')
|
30
30
|
s.add_runtime_dependency('faraday', '~> 0.7.0')
|
31
31
|
s.add_runtime_dependency('multi_json', '>= 1.0.0')
|
32
32
|
s.add_runtime_dependency('extlib', '>= 0.9.15')
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: google-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bob Aman
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-02-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: signet
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.3.1
|
24
24
|
type: :runtime
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 2.2.3
|
35
35
|
type: :runtime
|
@@ -40,9 +40,9 @@ dependencies:
|
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: 0.3.1
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
requirements: []
|
209
209
|
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 1.8.
|
211
|
+
rubygems_version: 1.8.15
|
212
212
|
signing_key:
|
213
213
|
specification_version: 3
|
214
214
|
summary: Package Summary
|