Top Level Namespace
Defined Under Namespace
Modules: Yamori
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
- #target_org ⇒ Object
- #use(target_org) ⇒ Object
Instance Method Details
#available_models ⇒ Object
25 26 27 |
# File 'lib/yamori/support/console.rb', line 25 def available_models @available_models ||= [] end |
#connection ⇒ Object Also known as: conn
35 36 37 |
# File 'lib/yamori/support/console.rb', line 35 def connection Yamori.connection end |
#current_org ⇒ Object
43 44 45 |
# File 'lib/yamori/support/console.rb', line 43 def current_org @current_org end |
#generate(*object_types) ⇒ Object Also known as: gen
29 30 31 32 33 |
# File 'lib/yamori/support/console.rb', line 29 def generate(*object_types) Yamori.generate(*object_types) available_models.append(*object_types).flatten.uniq object_types end |
#orgs ⇒ Object
54 55 56 57 58 |
# File 'lib/yamori/support/console.rb', line 54 def orgs conf.inspect_mode = false system 'sf org list' conf.inspect_mode = true end |
#query(_soql) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/yamori/support/console.rb', line 47 def query(_soql) soql = _soql.is_a?(Yamori::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 |
#target_org ⇒ Object
39 40 41 |
# File 'lib/yamori/support/console.rb', line 39 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 |
# File 'lib/yamori/support/console.rb', line 4 def use(target_org) config = sf.org.display target_org: target_org Yamori.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 = conn end @current_org = config true end |