Module: Card::Set::Abstract::Paging::JsonFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod008-pointer/abstract/01_paging.rb

Instance Method Summary collapse

Instance Method Details

#add_paging_url(hash, page, status) ⇒ Object



150
151
152
153
154
# File 'tmpsets/set/mod008-pointer/abstract/01_paging.rb', line 150

def add_paging_url hash, page, status
  return unless page && status.in?(%i[next previous])

  hash[status] = path page_link_path_args(page)
end


126
127
128
129
130
131
132
133
# File 'tmpsets/set/mod008-pointer/abstract/01_paging.rb', line 126

def page_link_path_args page
  {
    limit: limit,
    offset: page * limit,
    item: default_item_view, # hack. need standard voo handling
    format: :json
  }.merge extra_paging_path_args
end

#paging_urls_hashObject



141
142
143
144
145
146
147
148
# File 'tmpsets/set/mod008-pointer/abstract/01_paging.rb', line 141

def paging_urls_hash
  hash = {}
  PagingLinks.new(total_pages, current_page)
             .build do |_text, page, status, _options|
    add_paging_url hash, page, status
  end
  hash
end