Class: PredicsisMlSdk::Credentials
- Inherits:
-
Object
- Object
- PredicsisMlSdk::Credentials
show all
- Includes:
- Util
- Defined in:
- lib/predicsis_ml_sdk/credentials.rb
Instance Attribute Summary
Attributes included from Util
#token
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#bearer_token, #define_attributes, included, #with_captured_console
Constructor Details
#initialize(token = bearer_token) ⇒ Credentials
Returns a new instance of Credentials.
9
10
11
|
# File 'lib/predicsis_ml_sdk/credentials.rb', line 9
def initialize(token = bearer_token)
@token = token
end
|
Class Method Details
.get(type = 's3', token = bearer_token) ⇒ Object
5
6
7
|
# File 'lib/predicsis_ml_sdk/credentials.rb', line 5
def self.get(type = 's3', token = bearer_token)
new(token).get(type)
end
|
Instance Method Details
#get(type = 's3') ⇒ Object
13
14
15
16
17
|
# File 'lib/predicsis_ml_sdk/credentials.rb', line 13
def get(type = 's3')
data = Requests.get_credentials(type, token)
define_attributes(data)
self
end
|
#to_h ⇒ Object
19
20
21
22
23
|
# File 'lib/predicsis_ml_sdk/credentials.rb', line 19
def to_h
instance_variables.each_with_object({}) do |var, hash|
hash[var.to_s.delete("@")] = instance_variable_get(var) unless var.to_s == '@token'
end
end
|