Skip to content

Instantly share code, notes, and snippets.

@roccogalluzzo
Last active August 29, 2015 14:08
Show Gist options
  • Save roccogalluzzo/4711f0d14bbf43b498d7 to your computer and use it in GitHub Desktop.
Save roccogalluzzo/4711f0d14bbf43b498d7 to your computer and use it in GitHub Desktop.
# JSON
mailup = MailUp::API.new(credentials)
lists = mailup.console.user.lists
lists['Items'].first['Name']
# => "Test List"
list_id = lists['Items'].first['idList'].to_i
# => 1
list = mailup.console.list(list_id)
groups = list.groups(pageNumber: 1, pageSize: 25)
groups['IsPaginated']
# => true
groups['Skipped']
# => 25
groups['TotalElementsCount']
# => 35
groups['Items'].size
# => 10
# after refactoring
mailup = MailUp::API.new(credentials)
lists = mailup.console.user.lists
lists.first.name
# => "Test List"
list_id = lists.first.id
# => 1
list = mailup.console.list(list_id)
groups = list.groups(page_mumber: 1, page_size: 25)
groups.is_paginated?
# => true
groups.skypped
# => 25
groups.total_elements
# => 35
# oppure, ancora meglio
groups.size
# => 35
groups.items.size
# => 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment