Module: AppleDEPClient::Configuration
- Included in:
- AppleDEPClient
- Defined in:
- lib/apple_dep_client/configuration.rb
Constant Summary
collapse
- DEP_CONFIG =
{
private_key: nil, consumer_key: nil, consumer_secret: nil,
access_token: nil,
access_secret: nil,
access_token_expiry: nil,
apple_dep_server: "https://mdmenrollment.apple.com", user_agent: "CellabusMDM",
}
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *_args, &_block) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/apple_dep_client/configuration.rb', line 22
def method_missing(m, *_args, &_block)
if DEP_CONFIG.keys.include? m.to_sym
get_value(m)
else
raise NoMethodError, "Unknown method #{m}"
end
end
|
Instance Method Details
40
41
42
|
# File 'lib/apple_dep_client/configuration.rb', line 40
def configure
yield self
end
|
#get_default_value(key) ⇒ Object
36
37
38
|
# File 'lib/apple_dep_client/configuration.rb', line 36
def get_default_value(key)
DEP_CONFIG[key.to_sym]
end
|
#get_value(m) ⇒ Object
30
31
32
33
34
|
# File 'lib/apple_dep_client/configuration.rb', line 30
def get_value(m)
value = instance_variable_get("@#{m}")
value = get_default_value(m) if value.nil?
(value.is_a? Proc) ? value.call : value
end
|