module CrvApiClient::Helpers::Endpoint

Private Instance Methods

class_api_endpoint() click to toggle source

Calculates api endpoint path based on class who includes this module it adds the string ‘::Api’ before the last ‘::’ match. Regex splits the class name and modules by the last ‘::’ match 1 is the string before the last ‘::’ match

2 contains the last

match

3 contains the string after the ‘::’ match. Returns a string

example

class CrvApiClient::Animals returns CrvApiClient::Api::Animals class CrvApiClient::Base::Before::Animals returns CrvApiClient::Base::Before::Api::Animals

# File lib/crv_api_client/helpers/endpoint.rb, line 18
def class_api_endpoint
  self.class.name.gsub(/(.*)(::)(.*)/, '\1\2Api\2\3\2')
end
endpoint_animal_id() click to toggle source
# File lib/crv_api_client/helpers/endpoint.rb, line 40
def endpoint_animal_id
  Object.const_get(class_api_endpoint << "AnimalId")
end
endpoint_context_message() click to toggle source
# File lib/crv_api_client/helpers/endpoint.rb, line 36
def endpoint_context_message
  Object.const_get(class_api_endpoint << "ContextMessage")
end
endpoint_context_message_detail() click to toggle source

Returns the Api ContextMessageDetail of the included class.

# File lib/crv_api_client/helpers/endpoint.rb, line 32
def endpoint_context_message_detail
  Object.const_get(class_api_endpoint << "ContextMessageDetail")
end
endpoint_participant_id() click to toggle source

Returns the Api Participant Id of the included class.

# File lib/crv_api_client/helpers/endpoint.rb, line 25
def endpoint_participant_id
  Object.const_get(class_api_endpoint << "ParticipantId")
end