Class: FinApps::REST::Operators

Inherits:
FinAppsCore::REST::Resources
  • Object
show all
Includes:
Utils::QueryBuilder
Defined in:
lib/finapps/rest/operators.rb

Instance Method Summary collapse

Methods included from Utils::QueryBuilder

#build_query_path

Instance Method Details

#create(params, path = nil) ⇒ Object



23
24
25
26
# File 'lib/finapps/rest/operators.rb', line 23

def create(params, path = nil)
  not_blank(params, :params)
  super params, path
end

#destroy(id) ⇒ Object



46
47
48
49
# File 'lib/finapps/rest/operators.rb', line 46

def destroy(id)
  not_blank(id, :operator_id)
  super id
end

#list(params = nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/finapps/rest/operators.rb', line 10

def list(params = nil)
  return super if params.nil?
  fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash

  super build_query_path(end_point, params)
end

#show(id) ⇒ Object



17
18
19
20
21
# File 'lib/finapps/rest/operators.rb', line 17

def show(id)
  not_blank(id, :operator_id)

  super id
end

#update(id, params) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/finapps/rest/operators.rb', line 28

def update(id, params)
  not_blank(id, :operator_id)
  not_blank(params, :params)

  path = "#{end_point}/#{ERB::Util.url_encode(id)}"
  super params, path
end

#update_password(params) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/finapps/rest/operators.rb', line 36

def update_password(params)
  # update password for current operator, need authorization session in header
  not_blank(params, :params)
  fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params

  path = "#{end_point}/password/change"

  create params, path
end