Class: SimMeterAU::Provider
- Inherits:
-
Object
- Object
- SimMeterAU::Provider
show all
- Defined in:
- lib/sim_meter_au/provider.rb
Constant Summary
collapse
- OPERATIONS =
%i[
authenticate!
authenticated?
services
service
service_details
usage
orders
].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.credential_names(*names) ⇒ Object
26
27
28
29
|
# File 'lib/sim_meter_au/provider.rb', line 26
def credential_names(*names)
@credential_names = names.map(&:to_sym) unless names.empty?
@credential_names || []
end
|
.credentials_from(environment) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/sim_meter_au/provider.rb', line 31
def credentials_from(environment)
prefix = provider_key.to_s.upcase
credential_names.to_h do |name|
[name, environment.fetch("#{prefix}_#{name.to_s.upcase}", "")]
end
end
|
.display_name(value = nil) ⇒ Object
21
22
23
24
|
# File 'lib/sim_meter_au/provider.rb', line 21
def display_name(value = nil)
@display_name = value.to_s if value
@display_name || provider_key.to_s
end
|
.provider_key(value = nil) ⇒ Object
16
17
18
19
|
# File 'lib/sim_meter_au/provider.rb', line 16
def provider_key(value = nil)
@provider_key = value.to_sym if value
@provider_key
end
|
Instance Method Details
#authenticate! ⇒ Object
43
44
45
|
# File 'lib/sim_meter_au/provider.rb', line 43
def authenticate!
unsupported_operation(__method__)
end
|
#authenticated? ⇒ Boolean
51
52
53
|
# File 'lib/sim_meter_au/provider.rb', line 51
def authenticated?
unsupported_operation(__method__)
end
|
#login! ⇒ Object
47
48
49
|
# File 'lib/sim_meter_au/provider.rb', line 47
def login!
authenticate!
end
|
#orders(_identifier) ⇒ Object
71
72
73
|
# File 'lib/sim_meter_au/provider.rb', line 71
def orders(_identifier)
unsupported_operation(__method__)
end
|
#provider ⇒ Object
39
40
41
|
# File 'lib/sim_meter_au/provider.rb', line 39
def provider
self.class.provider_key
end
|
#service(_identifier) ⇒ Object
59
60
61
|
# File 'lib/sim_meter_au/provider.rb', line 59
def service(_identifier)
unsupported_operation(__method__)
end
|
#service_details(_identifier) ⇒ Object
63
64
65
|
# File 'lib/sim_meter_au/provider.rb', line 63
def service_details(_identifier)
unsupported_operation(__method__)
end
|
#services ⇒ Object
55
56
57
|
# File 'lib/sim_meter_au/provider.rb', line 55
def services
unsupported_operation(__method__)
end
|
#usage(_identifier, from:, to:) ⇒ Object
67
68
69
|
# File 'lib/sim_meter_au/provider.rb', line 67
def usage(_identifier, from:, to:)
unsupported_operation(__method__)
end
|