Class: Harvesting::Models::Users
- Inherits:
-
HarvestRecordCollection
- Object
- Base
- HarvestRecordCollection
- Harvesting::Models::Users
- Defined in:
- lib/harvesting/models/users.rb
Instance Attribute Summary
Attributes inherited from HarvestRecordCollection
Attributes inherited from Base
Instance Method Summary collapse
- #fetch_next_page ⇒ Object
-
#initialize(attrs, query_opts = {}, opts = {}) ⇒ Users
constructor
A new instance of Users.
Methods inherited from HarvestRecordCollection
#next_page_query_opts, #page, #size
Methods included from Enumerable
Methods inherited from Base
#create, #delete, #fetch, get, #save, #to_hash, #update
Constructor Details
#initialize(attrs, query_opts = {}, opts = {}) ⇒ Users
Returns a new instance of Users.
5 6 7 8 9 10 |
# File 'lib/harvesting/models/users.rb', line 5 def initialize(attrs, query_opts = {}, opts = {}) super(attrs.reject {|k,v| k == "users" }, query_opts, opts) @entries = attrs["users"].map do |entry| User.new(entry, harvest_client: opts[:harvest_client]) end end |
Instance Method Details
#fetch_next_page ⇒ Object
12 13 14 15 |
# File 'lib/harvesting/models/users.rb', line 12 def fetch_next_page @entries += harvest_client.users(next_page_query_opts).entries @attributes['page'] = page + 1 end |