Sha256: d5188e775734f293fa4bba45c7b6e41d18f703088ec21d62f291fa3dc245032d

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

module OmiseGO
  class List < Base
    attributes :data, :pagination

    def first
      data.first
    end

    def last
      data.last
    end

    def [](i)
      data[i]
    end

    def pagination
      @_pagination ||= if (pag = @original_payload['pagination'])
                         Pagination.new(pag)
                       end
    end

    def data
      @_data ||= @data.map do |element|
        klass = @client.config[:models][element['object'].to_sym]
        klass.new(element, client: @client)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
omisego-0.12.0 lib/omisego/list.rb
omisego-0.11.0 lib/omisego/list.rb
omisego-0.10.0 lib/omisego/list.rb
omisego-0.9.6 lib/omisego/list.rb
omisego-0.9.5 lib/omisego/list.rb
omisego-0.9.4 lib/omisego/list.rb