Sha256: be53dc44bd06ab1263e79e823a0dc1232bcee7ea41b6a2405cad1cfa804f851e

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

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

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

        protected

        def load_resource(options)
          request.get("/newsletter-subscriptions", options)
        end

        private

        def newsletter_subscriptions
          @newsletter_subscriptions ||= begin
            newsletter_subscriptions = []

            if data
              data.each do |newsletter_subscription|
                newsletter_subscriptions << Kentaa::Api::Resources::NewsletterSubscription.new(config, data: newsletter_subscription)
              end
            end

            newsletter_subscriptions
          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/newsletter_subscriptions.rb
kentaa-api-0.3.1 lib/kentaa/api/resources/newsletter_subscriptions.rb
kentaa-api-0.3.0 lib/kentaa/api/resources/newsletter_subscriptions.rb