Sha256: 41359970b666aeeacb972a317cf046290cdb6559c60453e896a35d6299a0b866

Contents?: true

Size: 735 Bytes

Versions: 16

Compression:

Stored size: 735 Bytes

Contents

module Localeapp
  module Routes
    module Translations
      def translations_url(options={})
        options[:format] ||= 'yml'
        url = http_scheme.build(base_options.merge(:path => translations_path(options[:format])))
        url.query = options[:query].map { |k,v| "#{k}=#{v}" }.join('&') if options[:query]
        url.to_s
      end

      def translations_endpoint(options = {})
        [:get, translations_url(options)]
      end

      def create_translation_endpoint(options = {})
        [:post, translations_url(options)]
      end

    private

      def translations_path(format = nil)
        path = project_path << '/translations'
        path << ".#{format}" if format
        path
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
localeapp-3.3.0 lib/localeapp/routes/translations.rb
localeapp-3.2.0 lib/localeapp/routes/translations.rb
localeapp-3.1.3 lib/localeapp/routes/translations.rb
localeapp-3.1.2 lib/localeapp/routes/translations.rb
localeapp-3.1.1 lib/localeapp/routes/translations.rb
localeapp-3.1.0 lib/localeapp/routes/translations.rb
localeapp-3.0.1 lib/localeapp/routes/translations.rb
localeapp-3.0.0 lib/localeapp/routes/translations.rb
localeapp-2.5.0 lib/localeapp/routes/translations.rb
localeapp-2.4.0 lib/localeapp/routes/translations.rb
localeapp-2.3.0 lib/localeapp/routes/translations.rb
localeapp-2.2.0 lib/localeapp/routes/translations.rb
localeapp-2.1.1 lib/localeapp/routes/translations.rb
localeapp-2.1.0 lib/localeapp/routes/translations.rb
localeapp-2.0.0 lib/localeapp/routes/translations.rb
localeapp-1.0.2 lib/localeapp/routes/translations.rb