Sha256: f769ab4327b2812951eadbb3b57c8699d7ecb073e095fbd00f7919316f55c7ff

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

module Axel
  module Configurations
    class Resource
      attr_reader :name
      attr_reader :service
      attr_accessor :attributes
      attr_writer :path

      def initialize(name, service, options = {})
        @name = name.to_s.singularize
        @service = service
        @attributes = options[:attributes] || []
        @path = options[:path] # If nil it will try to build URL from name and service
      end

      def full_url
        URI.join(base_url, path).to_s
      end

      def base_url
        service.url
      end

      def path
        @path || name.pluralize
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axel-0.0.1 lib/axel/configurations/resource.rb