Class: Xhash::SAT

Inherits:
ApiClient show all
Defined in:
lib/xhash/sat.rb

Class Method Summary collapse

Methods inherited from ApiClient

api_base, api_base=, api_key, api_key=, config, timeout, timeout=

Methods included from JsonApi

included

Class Method Details

.get_rfc(name: nil, last_name: nil, mothers_last_name: nil, birth_date: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/xhash/sat.rb', line 3

def self.get_rfc(
  name: nil, last_name: nil, mothers_last_name: nil, birth_date: nil
)
  url = 'sat/get-rfc'
  body = {
    name: name,
    last_name: last_name,
    mothers_last_name: mothers_last_name,
    birth_date: birth_date
  }
  response = api_post(url: url, body: body)
  raise Xhash::MissingRequiredFieldError.new(response) unless response[:rfc]
  Xhash::RFC.new(*response.values_at(*Xhash::RFC.members))
end