sobjectmodel 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 593a275d93ff933f9e7d9be260194f2da06f4b55285424589b739db5b80e4b8d
4
- data.tar.gz: d8723a40b412a472ba84d56658046cde7b320ed617e22c92264d93b8649d5aaa
3
+ metadata.gz: 328f6e06aa1dcde67def58a2146a95f1ca355c19cb14941846f6488c2aa4681c
4
+ data.tar.gz: df59863700a647440f82e9bc31b4f1ba26958d6350509fbec595097d915e5c0c
5
5
  SHA512:
6
- metadata.gz: 6dda884fe46731a0c8e25b372792908b3e4e43eb1d1a7693e97658cba06eeb6dadbff42ceedc7e04525072fe67b7027de372172ce637e567547b90b879bc799b
7
- data.tar.gz: 0cb40fb055300eaef7f198878c12f03652a7d79c70a0bef09ddb9d4b9ac949a92e231912be6ac0ee18d0142e446bbc8a713266d6ef9eaf817af4d2fdaf40815c
6
+ metadata.gz: 320377f566b03dd471981c9a7f1c538feb81b581f15307aa0d84a97844e4b7f4134acf4de5900a961796e6566fda1aa5f9abc145147c218982b71f464614ebf1
7
+ data.tar.gz: 9ad303b217d2f266bff897fd8f57b7eb9ad7fc4a01c10a242dce7b02e818bb7c63c0d38d93247f0e48bbda4a5fddf6210841bcfc4112dcc5d02ca530362ea4f5
@@ -29,6 +29,11 @@ module SObjectModel
29
29
  JSON.parse(response)
30
30
  end
31
31
 
32
+ def describe_global
33
+ response = http.get "/services/data/v#{api_version}/sobjects/"
34
+ JSON.parse(response)
35
+ end
36
+
32
37
  def find(object_type, id, fields: [])
33
38
  query = fields.empty? ? '' : %|?fields=#{fields.map(&:to_s).join(',')}|
34
39
  response = http.get "/services/data/v#{api_version}/sobjects/#{object_type}/#{id}#{query}"
@@ -3,18 +3,31 @@ require 'sobject_model'
3
3
 
4
4
  def use(target_org)
5
5
  config = sf.org.display target_org: target_org
6
- SObjectModel.connect(
7
- :rest,
8
- instance_url: config.instance_url,
9
- access_token: config.access_token,
10
- api_version: config.api_version
11
- )
6
+
7
+ @rest_client =
8
+ SObjectModel::Rest::Client.new(
9
+ instance_url: config.instance_url,
10
+ access_token: config.access_token,
11
+ api_version: config.api_version
12
+ )
13
+
14
+ adapter = SObjectModel::Adapter::Rest.new(@rest_client)
15
+
16
+ SObjectModel.connection = adapter
17
+
18
+ #SObjectModel.connect(
19
+ # :rest,
20
+ # instance_url: config.instance_url,
21
+ # access_token: config.access_token,
22
+ # api_version: config.api_version
23
+ #)
24
+
12
25
  unless config.connected?
13
26
  sf.org.login_web target_org: target_org, instance_url: config.instance_url
14
27
  end
15
28
 
16
29
  available_models.each do |model|
17
- Object.const_get(model).connection = conn
30
+ Object.const_get(model).connection = SObjectModel.connection
18
31
  end
19
32
 
20
33
  @current_org = config
@@ -44,6 +57,10 @@ def current_org
44
57
  @current_org
45
58
  end
46
59
 
60
+ def rest_client
61
+ @rest_client
62
+ end
63
+
47
64
  def query(_soql)
48
65
  soql = _soql.is_a?(SObjectModel::QueryMethods::QueryCondition) ? _soql.to_soql : _soql
49
66
  conf.inspect_mode = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sobjectmodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takanobu Maekawa
@@ -32,11 +32,11 @@ files:
32
32
  - lib/sobject_model/rest/query_result.rb
33
33
  - lib/sobject_model/schema.rb
34
34
  - lib/sobject_model/support/console.rb
35
- homepage: https://github.com/tmkw/sobjectmodel
35
+ homepage: https://tmkw.github.io/sobjectmodel/
36
36
  licenses:
37
37
  - BSD-2-Clause
38
38
  metadata:
39
- homepage_uri: https://github.com/tmkw/sobjectmodel
39
+ homepage_uri: https://tmkw.github.io/sobjectmodel/
40
40
  source_code_uri: https://github.com/tmkw/sobjectmodel
41
41
  post_install_message:
42
42
  rdoc_options: []