Class: Datashake::ReviewIndex::V1::BaseEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb

Direct Known Subclasses

Profiles, Reviews, UpdateStatus

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ BaseEndpoint

Returns a new instance of BaseEndpoint.



17
18
19
20
# File 'lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb', line 17

def initialize(version)
  @version = version
  @params = {}
end

Class Method Details

.request_parameters(request_parameters) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb', line 7

def self.request_parameters(request_parameters)
  request_parameters.each do |param_name|
    define_method(param_name) do |value|
      @params[param_name] = value

      self
    end
  end
end

Instance Method Details

#endpoint_pathObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb', line 32

def endpoint_path
  raise NotImplementedError, "Implement it in a successor class"
end

#fetchObject



22
23
24
25
26
# File 'lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb', line 22

def fetch
  response = version.fetch(method: :get, path: endpoint_path, params: params)

  response_class.new(response)
end

#response_classObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/datashake-ruby-sdk/review_index/v1/base_endpoint.rb', line 28

def response_class
  raise NotImplementedError, "Implement it in a successor class"
end