Sha256: 6013e9613b4759e02ec422949bcb8b39b92e1be1d8c9df26e8d2dac55946dc2f

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

require 'acfs/service/middleware'
require 'acfs/service/queue'

module Acfs

  # Service object.
  #
  class Service
    attr_accessor :options
    class_attribute :base_url

    include Service::Queue
    include Service::Middleware

    def initialize(options = {})
      @options = options
    end

    def options
      @options
    end

    def url_for(resource_class, options = {})
      options.reverse_merge! self.options

      url  = self.class.base_url.to_s
      url += "/#{(options[:path] || resource_class.name.pluralize.underscore).to_s}"
      url += "/#{options[:suffix].to_s}" if options[:suffix]
      url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acfs-0.7.0 lib/acfs/service.rb