Sha256: dfbe874cdaa0dc8bbf67e1f70169a2eb889957031e6d64e8b1b982546f360f9f

Contents?: true

Size: 719 Bytes

Versions: 10

Compression:

Stored size: 719 Bytes

Contents

module Kong
  module BelongsToConsumer
    attr_accessor :consumer

    # Convert API end point relative to Kong Consumer resource
    def use_consumer_end_point
      self.api_end_point = "/consumers/#{self.consumer_id}#{self.class::API_END_POINT}" if self.consumer_id
    end

    # Get Consumer resource
    # @return [Kong::Consumer]
    def consumer
      @consumer ||= Consumer.find(self.consumer_id)
    end

    # Set Consumer resource
    # @param [Kong::Consumer] consumer
    def consumer=(consumer)
      @consumer = consumer
      self.consumer_id = consumer.id
    end

    # Set Consumer id
    # @param [String] id
    def consumer_id=(id)
      super(id)
      use_consumer_end_point
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
kong-client-0.4.0 lib/kong/belongs_to_consumer.rb
kong-0.3.4 lib/kong/belongs_to_consumer.rb
kong-0.3.3 lib/kong/belongs_to_consumer.rb
kong-0.3.2 lib/kong/belongs_to_consumer.rb
kong-0.3.1 lib/kong/belongs_to_consumer.rb
kong-0.3.0 lib/kong/belongs_to_consumer.rb
kong-0.2.0 lib/kong/belongs_to_consumer.rb
kong-0.1.2 lib/kong/belongs_to_consumer.rb
kong-0.1.1 lib/kong/belongs_to_consumer.rb
kong-0.1.0 lib/kong/belongs_to_consumer.rb