Sha256: 5b2b221a43e6750890848abc671c93c5239788d7f2642c833f9bb0a03876a0ab

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module V1
      module Responses
        # Response when requesting users (list).
        class Users < Base
          include Enumerable

          def initialize(response)
            super(response)
          end

          def each(&block)
            users.each(&block)
          end

          private

          def users
            @users ||= begin
              users = []

              unless error?
                data.each do |user|
                  users << Tikkie::Api::V1::Responses::User.new(user)
                end
              end

              users
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tikkie-api-2.0.0 lib/tikkie/api/v1/responses/users.rb