Sha256: 9e221e7ab0587505044b2210bf98c1fbdc21fa0931e1eeb60d09a814212413e1
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true require "dry-validation" require "roseflow/proxycurl/object" require "roseflow/linkedin/person" require "roseflow/types" module Roseflow module LinkedIn class Person class RoleQuery < Proxycurl::ProxycurlObject class RoleQueryContract < Dry::Validation::Contract params do required(:role).filled(:string) required(:company_name).filled(:string) optional(:enrich).filled(:bool) end end contract_object RoleQueryContract schema schema.strict attribute :role, Types::String attribute :company_name, Types::String attribute? :enrich, Types::Bool.default(false) def self.new(input) validation = self.contract_object.new.call(input) raise ArgumentError, validation.errors.to_h.inspect unless validation.success? super(input) end def to_request_params params = { company_name: company_name, role: role, enrich_profile: enrich == true ? "enrich" : "skip", } params.each_pair do |key, value| params.delete(key) unless value end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems