Sha256: fb562a9bdb9b5b4634a301c2170578ea20347f9ae0f0a6de9e3dca8e617d98c5

Contents?: true

Size: 635 Bytes

Versions: 4

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    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::Responses::User.new(user)
              end
            end

            users
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tikkie-api-0.2.2 lib/tikkie/api/responses/users.rb
tikkie-api-0.2.1 lib/tikkie/api/responses/users.rb
tikkie-api-0.2.0 lib/tikkie/api/responses/users.rb
tikkie-api-0.1.1 lib/tikkie/api/responses/users.rb