Sha256: 16c70d2b6afbbc1d39b95e68e588f3e26991276cd87b22e5273be225a847e2a1
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require 'active_support/core_ext/array' require 'camel_snake_struct' module Snov class DomainSearch Response = Class.new(CamelSnakeStruct) Response.example(MultiJson.load(File.read("#{__dir__}/fake_client/get_v2_domain-emails-with-info.json"))) include Enumerable attr_reader :client, :domain, :type, :limit def initialize(domain:, type: 'all', limit: 10, last_id: 0, client: Snov.client) @client = client @domain = domain @type = type @limit = limit @last_id = last_id end def each(&block) emails.each(&block) end def success raw_result.success end def webmail raw_result.webmail end def result raw_result.result end def last_id raw_result.last_id end def company_name raw_result.company_name end def emails raw_result.emails end def raw_result @raw_result ||= Response.new(client.get("/v2/domain-emails-with-info", 'lastId' => @last_id, 'limit' => @limit, 'type' => type.to_s, 'domain' => domain.to_s)) end def to_h raw_result.to_h end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snov-0.2.4 | lib/snov/domain_search.rb |