databasedotcom 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -181,7 +181,7 @@ module Databasedotcom
181
181
  #
182
182
  # client.query("SELECT Name FROM Account") #=> [#<Account @Id=nil, @Name="Foo", ...>, #<Account @Id=nil, @Name="Bar", ...> ...]
183
183
  def query(soql_expr)
184
- result = http_get("/services/data/v#{self.version}/query?q=#{soql_expr}")
184
+ result = http_get("/services/data/v#{self.version}/query", :q => soql_expr)
185
185
  collection_from(result.body)
186
186
  end
187
187
 
@@ -189,7 +189,7 @@ module Databasedotcom
189
189
  #
190
190
  # client.search("FIND {bar}") #=> [#<Account @Name="foobar", ...>, #<Account @Name="barfoo", ...> ...]
191
191
  def search(sosl_expr)
192
- result = http_get("/services/data/v#{self.version}/search?q=#{sosl_expr}")
192
+ result = http_get("/services/data/v#{self.version}/search", :q => sosl_expr)
193
193
  collection_from(result.body)
194
194
  end
195
195
 
@@ -368,13 +368,17 @@ module Databasedotcom
368
368
  end
369
369
 
370
370
  def encode_parameters(parameters={})
371
- (parameters || {}).collect { |k, v| "#{URI.escape(k.to_s)}=#{URI.escape(v.to_s)}" }.join('&')
371
+ (parameters || {}).collect { |k, v| "#{uri_escape(k)}=#{uri_escape(v)}" }.join('&')
372
372
  end
373
373
 
374
374
  def log_request(path, options={})
375
375
  base_url = options[:host] ? "https://#{options[:host]}" : self.instance_url
376
376
  puts "***** REQUEST: #{path.include?(':') ? path : URI.join(base_url, path)}#{options[:data] ? " => #{options[:data]}" : ''}" if self.debugging
377
377
  end
378
+
379
+ def uri_escape(str)
380
+ URI.escape(str.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
381
+ end
378
382
 
379
383
  def log_response(result)
380
384
  puts "***** RESPONSE: #{result.class.name} -> #{result.body}" if self.debugging
@@ -98,13 +98,14 @@ module Databasedotcom
98
98
  end
99
99
  end
100
100
 
101
- # Reloads the record from the Force.com database. Returns the reloaded record.
101
+ # Reloads the record from the Force.com database. Returns self.
102
102
  #
103
103
  # client.materialize("Car")
104
104
  # c = Car.find_by_Color("Yellow")
105
105
  # c.reload
106
106
  def reload
107
- self.class.find(self.Id)
107
+ self.attributes = self.class.find(self.Id).attributes
108
+ self
108
109
  end
109
110
 
110
111
  def [](attr_name)
@@ -303,7 +304,7 @@ module Databasedotcom
303
304
  params.inject([]) do |arr, av|
304
305
  case av[1]
305
306
  when String
306
- value_str = "'#{av[1]}'"
307
+ value_str = "'#{av[1].gsub("'", "\\\\'")}'"
307
308
  when DateTime, Time
308
309
  value_str = av[1].strftime("%Y-%m-%dT%H:%M:%S.%L%z").insert(-3, ":")
309
310
  else
@@ -1,3 +1,3 @@
1
1
  module Databasedotcom
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: databasedotcom
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.2
5
+ version: 1.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Glenn Gillen, Danny Burkes & Richard Zhao
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-04 00:00:00 Z
13
+ date: 2011-10-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multipart-post