class Height::ListResponse

Attributes

items[R]

Public Class Methods

build(ary) click to toggle source
# File lib/height/list_response.rb, line 12
def build(ary)
  items = ary.map { |item| Height::Model.for(item) }
  new(items)
end
new(items) click to toggle source
# File lib/height/list_response.rb, line 20
def initialize(items)
  @items = items
end
parse(json) click to toggle source
# File lib/height/list_response.rb, line 5
def parse(json)
  response = JSON.parse(json)
  items = response['list'].map { |item| Height::Model.for(item) }

  new(items)
end

Public Instance Methods

count() click to toggle source
# File lib/height/list_response.rb, line 28
def count
  @items.count
end
each(&block) click to toggle source
# File lib/height/list_response.rb, line 32
def each(&block)
  @items.each(&block)
end
empty?() click to toggle source
# File lib/height/list_response.rb, line 24
def empty?
  count.zero?
end
last() click to toggle source
# File lib/height/list_response.rb, line 36
def last
  @items.last
end