Sha256: b4a1828ebb4563fbd6ebf7f915ee2964ad3c74ad74c7301bc834794ae0f2b665

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Kentaa
  module Api
    module Resources
      class Segments < List
        include Enumerable

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

        protected

        def load_resource(options)
          request.get("/segments", options)
        end

        private

        def segments
          @segments ||= begin
            segments = []

            if data
              data.each do |segment|
                segments << Kentaa::Api::Resources::Segment.new(config, data: segment)
              end
            end

            segments
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kentaa-api-0.3.2 lib/kentaa/api/resources/segments.rb
kentaa-api-0.3.1 lib/kentaa/api/resources/segments.rb
kentaa-api-0.3.0 lib/kentaa/api/resources/segments.rb