Module: CompaniesHouseGateway::Checks::Check

Included in:
CompanyAppointments, CompanyDetails, Document, DocumentInfo, FilingHistory, Mortgages, NameSearch, NumberSearch, OfficerDetails, OfficerSearch
Defined in:
lib/companies_house_gateway/checks/check.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/companies_house_gateway/checks/check.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initialize(client) ⇒ Object



8
9
10
# File 'lib/companies_house_gateway/checks/check.rb', line 8

def initialize(client)
  @client = client
end

#perform(data = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/companies_house_gateway/checks/check.rb', line 12

def perform(data = {})
  data = self.class.default_inputs.merge(data)
  check_params(data)
  check_type = Util.underscore(Util.demodulize(self.class))
  response = @client.perform_check(check_type, data)
  @client.config[:raw] ? response : response_body(response)
end