Class: Layer::Platform::Client
Constant Summary
Constants inherited
from BaseClient
BaseClient::DEFAULT_HOST
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from BaseClient
#client, #strip_layer_prefix
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
6
7
8
9
10
|
# File 'lib/layer/platform/client.rb', line 6
def initialize(options = {})
id = options[:app_id] || ENV['LAYER_APP_ID']
@api_token = options[:api_token] || ENV['LAYER_API_TOKEN']
@app_id = strip_layer_prefix(id)
end
|
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
4
5
6
|
# File 'lib/layer/platform/client.rb', line 4
def api_token
@api_token
end
|
#app_id ⇒ Object
Returns the value of attribute app_id.
4
5
6
|
# File 'lib/layer/platform/client.rb', line 4
def app_id
@app_id
end
|
Instance Method Details
#base_url ⇒ Object
32
33
34
|
# File 'lib/layer/platform/client.rb', line 32
def base_url
"#{DEFAULT_HOST}/apps/#{app_id}"
end
|
28
29
30
|
# File 'lib/layer/platform/client.rb', line 28
def
super.merge({"Authorization" => "Bearer #{api_token}"})
end
|
#generate_identity_token(options = {}) ⇒ Object
24
25
26
|
# File 'lib/layer/platform/client.rb', line 24
def generate_identity_token(options = {})
Layer::IdentityToken.new(options)
end
|
#inspect ⇒ Object
Also known as:
to_s
36
37
38
|
# File 'lib/layer/platform/client.rb', line 36
def inspect
"#<#{self.class} api_token=\"#{@api_token}\" app_id=\"#{@app_id}\">"
end
|