google_apps 0.3.9 → 0.3.10

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.
Files changed (2) hide show
  1. data/lib/google_apps/transport.rb +10 -8
  2. metadata +2 -2
@@ -119,7 +119,7 @@ module GoogleApps
119
119
  # get returns the HTTP response received from Google.
120
120
  def get(endpoint, id = nil)
121
121
  # TODO: Need to handle <link rel='next' for pagination if wanting all users
122
- id ? uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}") : uri = URI(instance_variable_get("@#{endpoint.to_s}"))
122
+ id ? uri = URI(endpoint + "/#{id}") : uri = URI(endpoint)
123
123
  #uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}")
124
124
  @request = Net::HTTP::Get.new(uri.path)
125
125
  set_headers :user
@@ -136,7 +136,7 @@ module GoogleApps
136
136
  #
137
137
  # add returns the HTTP response received from Google.
138
138
  def add(endpoint, document)
139
- uri = URI(instance_variable_get("@#{endpoint.to_s}"))
139
+ uri = URI(endpoint)
140
140
  @request = Net::HTTP::Post.new(uri.path)
141
141
  @request.body = document.to_s
142
142
  set_headers :user
@@ -155,7 +155,7 @@ module GoogleApps
155
155
  # update returns the HTTP response received from Google
156
156
  def update(endpoint, target, document)
157
157
  # TODO: Username needs to come from somewhere for uri
158
- uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{target}")
158
+ uri = URI(endpoint + "/#{target}")
159
159
  @request = Net::HTTP::Put.new(uri.path)
160
160
  @request.body = document.to_s
161
161
  set_headers :user
@@ -172,7 +172,7 @@ module GoogleApps
172
172
  #
173
173
  # delete returns the HTTP response received from Google.
174
174
  def delete(endpoint, id)
175
- uri = URI(instance_variable_get("@#{endpoint.to_s}") + "/#{id}")
175
+ uri = URI(endpoint + "/#{id}")
176
176
  @request = Net::HTTP::Delete.new(uri.path)
177
177
  set_headers :user
178
178
 
@@ -196,18 +196,20 @@ module GoogleApps
196
196
  @response = request(uri)
197
197
  end
198
198
 
199
+
200
+ # TODO: This should perform the instance_variable_get and pass the value to the appropriate method.
199
201
  def method_missing(name, *args)
200
202
  super unless name.match /([a-z]*)_([a-z]*)/
201
203
 
202
204
  case $1
203
205
  when "new"
204
- self.send(:add, $2, *args)
206
+ self.send(:add, instance_variable_get("@#{$2}"), *args)
205
207
  when "delete"
206
- self.send(:delete, $2, *args)
208
+ self.send(:delete, instance_variable_get("@#{$2}"), *args)
207
209
  when "update"
208
- self.send(:update, $2, *args)
210
+ self.send(:update, instance_variable_get("@#{$2}"), *args)
209
211
  when "get"
210
- self.send(:get, $2, *args)
212
+ self.send(:get, instance_variable_get("@#{$2}"), *args)
211
213
  else
212
214
  super
213
215
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_apps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-07 00:00:00.000000000 Z
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Library for interfacing with Google Apps' Domain and Application APIs
15
15
  email: