Class: Snov::GetProspectList
- Inherits:
-
Object
- Object
- Snov::GetProspectList
- Includes:
- Enumerable
- Defined in:
- lib/snov/get_prospect_list.rb
Defined Under Namespace
Classes: ProspectEmail, ProspectResult
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#list_id ⇒ Object
readonly
Returns the value of attribute list_id.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(list_id:, page:, per_page: 100, client: Snov.client) ⇒ GetProspectList
constructor
A new instance of GetProspectList.
- #prospects ⇒ Object
- #raw_result ⇒ Object
Constructor Details
#initialize(list_id:, page:, per_page: 100, client: Snov.client) ⇒ GetProspectList
Returns a new instance of GetProspectList.
9 10 11 12 13 14 |
# File 'lib/snov/get_prospect_list.rb', line 9 def initialize(list_id:, page:, per_page: 100, client: Snov.client) @client = client @list_id = list_id @page = page @per_page = per_page end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/snov/get_prospect_list.rb', line 7 def client @client end |
#list_id ⇒ Object (readonly)
Returns the value of attribute list_id.
7 8 9 |
# File 'lib/snov/get_prospect_list.rb', line 7 def list_id @list_id end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
7 8 9 |
# File 'lib/snov/get_prospect_list.rb', line 7 def page @page end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
7 8 9 |
# File 'lib/snov/get_prospect_list.rb', line 7 def per_page @per_page end |
Instance Method Details
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/snov/get_prospect_list.rb', line 16 def each(&block) prospects.each(&block) end |
#prospects ⇒ Object
20 21 22 23 24 |
# File 'lib/snov/get_prospect_list.rb', line 20 def prospects @prospects ||= raw_result.fetch('prospects').map do |result| ProspectResult.new(result) end end |
#raw_result ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/snov/get_prospect_list.rb', line 26 def raw_result @raw_result ||= client.post("/v1/prospect-list", 'listId' => list_id.to_s, 'page' => page.to_s, 'perPage' => per_page.to_s) .deep_transform_keys! { |key| key.underscore } end |