Top Level Namespace
Defined Under Namespace
Modules: SObjectModel
Instance Method Summary collapse
- #available_models ⇒ Object
- #connection ⇒ Object (also: #conn)
- #current_org ⇒ Object
- #generate(*object_types) ⇒ Object (also: #gen)
- #orgs ⇒ Object
- #query(_soql) ⇒ Object
- #rest_client ⇒ Object
- #target_org ⇒ Object
- #use(target_org) ⇒ Object
Instance Method Details
#available_models ⇒ Object
38 39 40 |
# File 'lib/sobject_model/support/console.rb', line 38 def available_models @available_models ||= [] end |
#connection ⇒ Object Also known as: conn
48 49 50 |
# File 'lib/sobject_model/support/console.rb', line 48 def connection SObjectModel.connection end |
#current_org ⇒ Object
56 57 58 |
# File 'lib/sobject_model/support/console.rb', line 56 def current_org @current_org end |
#generate(*object_types) ⇒ Object Also known as: gen
42 43 44 45 46 |
# File 'lib/sobject_model/support/console.rb', line 42 def generate(*object_types) SObjectModel.generate(*object_types) available_models.append(*object_types).flatten.uniq object_types end |
#orgs ⇒ Object
71 72 73 74 75 |
# File 'lib/sobject_model/support/console.rb', line 71 def orgs conf.inspect_mode = false system 'sf org list' conf.inspect_mode = true end |
#query(_soql) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/sobject_model/support/console.rb', line 64 def query(_soql) soql = _soql.is_a?(SObjectModel::QueryMethods::QueryCondition) ? _soql.to_soql : _soql conf.inspect_mode = false puts sf.data.query(soql, format: :human, target_org: target_org) conf.inspect_mode = true end |
#rest_client ⇒ Object
60 61 62 |
# File 'lib/sobject_model/support/console.rb', line 60 def rest_client @rest_client end |
#target_org ⇒ Object
52 53 54 |
# File 'lib/sobject_model/support/console.rb', line 52 def target_org current_org.alias end |
#use(target_org) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sobject_model/support/console.rb', line 4 def use(target_org) config = sf.org.display target_org: target_org @rest_client = SObjectModel::Rest::Client.new( instance_url: config.instance_url, access_token: config.access_token, api_version: config.api_version ) adapter = SObjectModel::Adapter::Rest.new(@rest_client) SObjectModel.connection = adapter #SObjectModel.connect( # :rest, # instance_url: config.instance_url, # access_token: config.access_token, # api_version: config.api_version #) unless config.connected? sf.org.login_web target_org: target_org, instance_url: config.instance_url end available_models.each do |model| Object.const_get(model).connection = SObjectModel.connection end @current_org = config true end |