Sha256: de4a50988666302ab47a01d07b82af88b1e33da48aa355600dea24e961bfdd89

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

require_relative 'resource'

module Contentful
  module Management
    # Resource class for UsagePeriod.
    # @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-usages
    class UsagePeriod
      include Contentful::Management::Resource
      include Contentful::Management::Resource::Refresher
      include Contentful::Management::Resource::SystemProperties

      property :startDate, :date
      property :endDate, :date

      # @private
      def self.build_endpoint(endpoint_options)
        organization_id = endpoint_options[:organization_id]

        "organizations/#{organization_id}/usage_periods"
      end

      # Gets all usage periods for a given organization.
      #
      # @param [Contentful::Management::Client] client
      # @param [String] organization_id
      # @param [Hash] params
      #
      # @return [Contentful::Management::Array<Contentful::Management::UsagePeriod>]
      def self.all(client, organization_id, params = {})
        ClientUsagePeriodMethodsFactory.new(client, organization_id).all(params)
      end

      # Not supported
      def self.find(*)
        fail 'Not supported'
      end

      # @private
      def self.endpoint
        'usages'
      end

      # Not supported
      def self.create(*)
        fail 'Not supported'
      end

      # Not supported
      def destroy
        fail 'Not supported'
      end

      # Not supported
      def update(*)
        fail 'Not supported'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
contentful-management-2.11.0 lib/contentful/management/usage_period.rb
contentful-management-2.10.0 lib/contentful/management/usage_period.rb
contentful-management-2.9.1 lib/contentful/management/usage_period.rb
contentful-management-2.9.0 lib/contentful/management/usage_period.rb
contentful-management-2.8.2 lib/contentful/management/usage_period.rb
contentful-management-2.8.1 lib/contentful/management/usage_period.rb
contentful-management-2.8.0 lib/contentful/management/usage_period.rb
contentful-management-2.7.0 lib/contentful/management/usage_period.rb
contentful-management-2.6.0 lib/contentful/management/usage_period.rb