Class: Connect::ApiAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/connect/api_adapter.rb

Class Method Summary collapse

Class Method Details

.client(env = ENV) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/connect/api_adapter.rb', line 12

def client(env=ENV)
  @client ||= Restforce.new(
    api_version:    env.fetch('API_VERSION', "41.0"),
    host:           env.fetch("SALESFORCE_REST_API_HOST"),
    client_id:      env.fetch("SALESFORCE_REST_API_CLIENT_ID"),
    client_secret:  env.fetch("SALESFORCE_REST_API_CLIENT_SECRET"),
    username:       env.fetch("SALESFORCE_REST_API_USERNAME"),
    password:       env.fetch("SALESFORCE_REST_API_PASSWORD"),
    security_token: env.fetch("SALESFORCE_REST_API_SECURITY_TOKEN", ""),
  )
end

.describe(env = ENV) ⇒ Object



8
9
10
# File 'lib/connect/api_adapter.rb', line 8

def describe(env=ENV)
  client(env).describe
end

.tooling(env = ENV) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/connect/api_adapter.rb', line 24

def tooling(env=ENV)
  @tooling ||= Restforce::Tooling::Client.new(
    api_version:    env.fetch('API_VERSION', "41.0"),
    host:           env.fetch("SALESFORCE_REST_API_HOST"),
    client_id:      env.fetch("SALESFORCE_REST_API_CLIENT_ID"),
    client_secret:  env.fetch("SALESFORCE_REST_API_CLIENT_SECRET"),
    username:       env.fetch("SALESFORCE_REST_API_USERNAME"),
    password:       env.fetch("SALESFORCE_REST_API_PASSWORD"),
    security_token: env.fetch("SALESFORCE_REST_API_SECURITY_TOKEN", ""),
  )
end