Class: Snov::GetAllProspectsFromList
- Inherits:
-
Object
- Object
- Snov::GetAllProspectsFromList
- Includes:
- Enumerable
- Defined in:
- lib/snov/get_all_prospects_from_list.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#list_id ⇒ Object
readonly
Returns the value of attribute list_id.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(list_id:, max: 9999, per_page: 100, client: Snov.client) ⇒ GetAllProspectsFromList
constructor
A new instance of GetAllProspectsFromList.
Constructor Details
#initialize(list_id:, max: 9999, per_page: 100, client: Snov.client) ⇒ GetAllProspectsFromList
Returns a new instance of GetAllProspectsFromList.
7 8 9 10 11 12 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 7 def initialize(list_id:, max: 9999, per_page: 100, client: Snov.client) @client = client @list_id = list_id @max = max.to_int @per_page = per_page end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 5 def client @client end |
#list_id ⇒ Object (readonly)
Returns the value of attribute list_id.
5 6 7 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 5 def list_id @list_id end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
5 6 7 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 5 def max @max end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
5 6 7 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 5 def per_page @per_page end |
Instance Method Details
#each(&block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/snov/get_all_prospects_from_list.rb', line 14 def each(&block) (1..max).each do |page| list = GetProspectList.new(list_id: list_id, page: page, per_page: per_page, client: client) prospects = list.prospects prospects.each(&block) break if prospects.size < per_page end end |