class KOSapiClient::ResponseLinks
Attributes
next[R]
prev[R]
Public Class Methods
new(prev_link, next_link)
click to toggle source
# File lib/kosapi_client/response_links.rb, line 8 def initialize(prev_link, next_link) @prev = prev_link @next = next_link end
parse(hash, client)
click to toggle source
# File lib/kosapi_client/response_links.rb, line 15 def parse(hash, client) prev_link = parse_link(hash, 'prev', client) next_link = parse_link(hash, 'next', client) new(prev_link, next_link) end
Private Class Methods
extract_link_hash(hash, rel)
click to toggle source
# File lib/kosapi_client/response_links.rb, line 32 def extract_link_hash(hash, rel) hash = [hash] unless hash.instance_of?(Array) hash.find { |it| it[:rel] == rel } end
parse_link(hash, rel, client)
click to toggle source
# File lib/kosapi_client/response_links.rb, line 22 def parse_link(hash, rel, client) return nil unless hash link_hash = extract_link_hash(hash, rel) if link_hash link = Entity::Link.parse(link_hash) link.inject_client(client) link end end