sobjectmodel 0.1.2 → 0.1.4

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: 930b04a95cceac236260d2ad5e3980357be0771eac205d40845c089a7d5e098f
4
+ data.tar.gz: 69df2c359d3464e220fc959109cd5a3f8f3100ae3bdcd96093aca6f17a417f04
5
5
  SHA512:
6
- metadata.gz: 6dda884fe46731a0c8e25b372792908b3e4e43eb1d1a7693e97658cba06eeb6dadbff42ceedc7e04525072fe67b7027de372172ce637e567547b90b879bc799b
7
- data.tar.gz: 0cb40fb055300eaef7f198878c12f03652a7d79c70a0bef09ddb9d4b9ac949a92e231912be6ac0ee18d0142e446bbc8a713266d6ef9eaf817af4d2fdaf40815c
6
+ metadata.gz: f77de46f6b207b2360b3c2d8249bd58122194f07e9849c1d4d05f66d40bf55f125e9fed1290e1bb2ec2449a9e47853a2913c7ebaeda700a227da67d1763ccaed
7
+ data.tar.gz: e5fd37561fa8caba3f660f164f29dc0f01dbba1c024e86ab2cb89e9767f519fe6426d6b60fe3f52afea7321dfb59d4c16c15ff842e5ed17acf1aaa07bc05fcf7
@@ -1,3 +1,4 @@
1
+ require_relative '../sobject_model'
1
2
  require_relative './class_definition'
2
3
 
3
4
  module SObjectModel
@@ -23,6 +24,7 @@ module SObjectModel
23
24
  instance_eval "::#{object_type} = #{class_definition}"
24
25
  klass = Object.const_get object_type.to_sym
25
26
  klass.connection = connection
27
+ SObjectModel.generated_classes << klass
26
28
  generated_types << object_type
27
29
  end
28
30
 
@@ -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}"
@@ -12,7 +12,7 @@ module SObjectModel
12
12
  end
13
13
 
14
14
  def to_s
15
- %|[#{@code}] #{@msg}|
15
+ %|[#{@error_code}] #{@error_message}|
16
16
  end
17
17
  end
18
18
  end
@@ -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
data/lib/sobject_model.rb CHANGED
@@ -18,6 +18,10 @@ module SObjectModel
18
18
  @connection
19
19
  end
20
20
 
21
+ def self.generated_classes
22
+ @generated_classes ||= []
23
+ end
24
+
21
25
  def self.connection=(connector)
22
26
  @connection = connector
23
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takanobu Maekawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-04 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Saleforce sObject class library
14
14
  email:
@@ -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: []