Class: Zaig::RegistrationPayload
- Inherits:
-
Object
- Object
- Zaig::RegistrationPayload
- Includes:
- Singleton
- Defined in:
- lib/zaig/registration_payload.rb
Overview
Service class to build a registration payload request.
Instance Method Summary collapse
Instance Method Details
#call(obj) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zaig/registration_payload.rb', line 10 def call(obj) { address: build_address(obj["address"]), client_category: obj["client_category"], constitution_date: Date.parse(obj["constitution_date"]).to_s, constitution_type: obj["constitution_type"], credit_request_date: obj["credit_request_date"], credit_type: obj["credit_type"] || "clean", document_number: CNPJ.new(obj["document_number"]).number, email: obj["email"], financial: obj.key?("financial") ? build_financial(obj["financial"]) : nil, guarantors: obj.key?("guarantors") ? build_shareholders(obj["guarantors"]) : nil, id: obj["id"], legal_name: obj["legal_name"], monthly_revenue: obj["monthly_revenue"].to_f, phones: build_phones(obj["phones"]), shareholders: build_shareholders(obj["shareholders"]), source: obj.key?("source") ? build_source(obj["source"]) : nil, scr_parameters: obj.key?("scr_parameters") ? build_scr_parameters(obj["scr_parameters"]) : nil, trading_name: obj["trading_name"], warrants: obj.key?("warrants") ? build_warrants(obj["warrants"]) : nil } end |