Class: Mdm::Enrollment::Service::Base
- Inherits:
-
Object
- Object
- Mdm::Enrollment::Service::Base
show all
- Defined in:
- lib/mdm/enrollment/service/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.accepted_params ⇒ Object
13
14
15
|
# File 'lib/mdm/enrollment/service/base.rb', line 13
def self.accepted_params
[]
end
|
.available_services ⇒ Object
9
10
11
|
# File 'lib/mdm/enrollment/service/base.rb', line 9
def self.available_services
[:account]
end
|
Instance Method Details
#authenticate? ⇒ Boolean
43
44
45
|
# File 'lib/mdm/enrollment/service/base.rb', line 43
def authenticate?
true
end
|
#method ⇒ Object
35
36
37
|
# File 'lib/mdm/enrollment/service/base.rb', line 35
def method
raise 'Subclasses must implement this method'
end
|
#params ⇒ Object
47
48
49
|
# File 'lib/mdm/enrollment/service/base.rb', line 47
def params
@params ||= {}
end
|
#params=(params) ⇒ Object
51
52
53
|
# File 'lib/mdm/enrollment/service/base.rb', line 51
def params=(params)
@params = params.permit(self.class.accepted_params)
end
|
#path ⇒ Object
39
40
41
|
# File 'lib/mdm/enrollment/service/base.rb', line 39
def path
raise 'Subclasses must implement this method'
end
|
#result ⇒ Object
31
32
33
|
# File 'lib/mdm/enrollment/service/base.rb', line 31
def result
raise 'Subclasses must implement this method'
end
|
#start ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mdm/enrollment/service/base.rb', line 17
def start
if authenticate?
client.authenticate!
end
options = if [:post, :put].include? method
{ body: params.to_json }
else
{ query: params }
end
client.send(method, path, options)
end
|