Class: RatingChgkV2::Endpoints::BaseEndpoint

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/rating_chgk_v2/endpoints/base_endpoint.rb

Constant Summary collapse

HTTP_METHODS =
%i[get post put delete patch].freeze

Constants included from Connection

Connection::BASE_URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

#delete, #get, #patch, #post, #put

Methods included from JsonHandler

#custom_dump, #custom_load

Methods included from Connection

#connection

Constructor Details

#initialize(client, query_params = [], params = {}) ⇒ BaseEndpoint

Returns a new instance of BaseEndpoint.



12
13
14
15
# File 'lib/rating_chgk_v2/endpoints/base_endpoint.rb', line 12

def initialize(client, query_params = [], params = {})
  @instance_query = base_query.push(*query_params)
  setup client, @instance_query, params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/rating_chgk_v2/endpoints/base_endpoint.rb', line 8

def params
  @params
end

Instance Method Details

#reinitialize(new_params: {}, add_query: []) ⇒ Object



17
18
19
20
21
22
# File 'lib/rating_chgk_v2/endpoints/base_endpoint.rb', line 17

def reinitialize(new_params: {}, add_query: [])
  add_query = [add_query] unless add_query.is_a?(Array)
  new_query = add_query&.any? ? @instance_query + add_query : @query_params
  setup @client, new_query, new_params
  self
end