databasedotcom_additions 0.6.2 → 0.6.3

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.
@@ -12,6 +12,8 @@ module Databasedotcom
12
12
 
13
13
  alias_method :query_orig, :query
14
14
 
15
+ SERIALIZE_PROPERTIES = %w(host username password version oauth_token instance_url session_id server_url)
16
+
15
17
  # opt username, password, sandbox
16
18
  def self.username_password_login(opt)
17
19
  client = Databasedotcom::Client.new :verify_mode => OpenSSL::SSL::VERIFY_NONE
@@ -37,6 +39,22 @@ module Databasedotcom
37
39
  client
38
40
  end
39
41
 
42
+ def serialize
43
+ o = {}
44
+ SERIALIZE_PROPERTIES.each do |prop|
45
+ o[prop] = client.send(prop.to_sym)
46
+ end
47
+ o
48
+ end
49
+
50
+ def self.client_from_serialized(serialized_client)
51
+ client = Databasedotcom::Client.new :verify_mode => OpenSSL::SSL::VERIFY_NONE
52
+ SERIALIZE_PROPERTIES.each do |prop|
53
+ client.send("#{prop}=", o[prop])
54
+ end
55
+ client
56
+ end
57
+
40
58
  def cache
41
59
 
42
60
  if ! defined?(@global_cache)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databasedotcom_additions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -80,3 +80,4 @@ signing_key:
80
80
  specification_version: 3
81
81
  summary: databasedotcom additions
82
82
  test_files: []
83
+ has_rdoc: