Class: FinAppsCore::REST::Resources

Inherits:
Object
  • Object
show all
Includes:
Utils::Loggeable, Utils::ParameterFilter, Utils::Validatable
Defined in:
lib/finapps_core/rest/resources.rb

Overview

:nodoc:

Constant Summary

Constants included from Utils::ParameterFilter

Utils::ParameterFilter::PROTECTED_KEYS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::ParameterFilter

#skip_sensitive_data

Methods included from Utils::Validatable

#not_blank

Methods included from Utils::Loggeable

#logger

Constructor Details

#initialize(client) ⇒ FinAppsCore::REST::Resources

Parameters:

  • client (FinAppsCore::REST::Client)


18
19
20
21
22
# File 'lib/finapps_core/rest/resources.rb', line 18

def initialize(client)
  not_blank(client, :client)
  @client = client
  @logger = client.logger if client.respond_to?(:logger)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/finapps_core/rest/resources.rb', line 14

def client
  @client
end

Instance Method Details

#create(params = {}, path = nil) ⇒ Object



29
30
31
# File 'lib/finapps_core/rest/resources.rb', line 29

def create(params={}, path=nil)
  request_with_body(path, :post, params)
end

#destroy(id = nil, path = nil) ⇒ Object



41
42
43
# File 'lib/finapps_core/rest/resources.rb', line 41

def destroy(id=nil, path=nil)
  request_without_body(path, :delete, id)
end

#list(path = nil) ⇒ Object



24
25
26
27
# File 'lib/finapps_core/rest/resources.rb', line 24

def list(path=nil)
  path = end_point.to_s if path.nil?
  request_with_body(path, :get, {})
end

#show(id = nil, path = nil) ⇒ Object



37
38
39
# File 'lib/finapps_core/rest/resources.rb', line 37

def show(id=nil, path=nil)
  request_without_body(path, :get, id)
end

#update(params = {}, path = nil) ⇒ Object



33
34
35
# File 'lib/finapps_core/rest/resources.rb', line 33

def update(params={}, path=nil)
  request_with_body(path, :put, params)
end