Module: Localeapp::Routes
Constant Summary collapse
- VERSION =
'v1'
Instance Method Summary collapse
- #create_translation_endpoint(options = {}) ⇒ Object
- #export_endpoint(options = {}) ⇒ Object
- #export_url(options = {}) ⇒ Object
- #import_endpoint(options = {}) ⇒ Object
- #import_url(options = {}) ⇒ Object
- #missing_translations_endpoint(options = {}) ⇒ Object
- #missing_translations_url(options = {}) ⇒ Object
- #project_endpoint(options = {}) ⇒ Object
- #project_url(options = {}) ⇒ Object
- #remove_endpoint(options = {}) ⇒ Object
- #remove_url(options = {}) ⇒ Object
- #rename_endpoint(options = {}) ⇒ Object
- #rename_url(options = {}) ⇒ Object
- #translations_endpoint(options = {}) ⇒ Object
- #translations_url(options = {}) ⇒ Object
Instance Method Details
#create_translation_endpoint(options = {}) ⇒ Object
27 28 29 |
# File 'lib/localeapp/routes.rb', line 27 def create_translation_endpoint( = {}) [:post, translations_url()] end |
#export_endpoint(options = {}) ⇒ Object
31 32 33 |
# File 'lib/localeapp/routes.rb', line 31 def export_endpoint( = {}) [:get, export_url()] end |
#export_url(options = {}) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/localeapp/routes.rb', line 53 def export_url( = {}) [:format] ||= 'yml' url = http_scheme.build(.merge(:path => export_path([:format]))) url.query = [:query].map { |k,v| "#{k}=#{v}" }.join('&') if [:query] url.to_s end |
#import_endpoint(options = {}) ⇒ Object
71 72 73 |
# File 'lib/localeapp/routes.rb', line 71 def import_endpoint( = {}) [:post, import_url()] end |
#import_url(options = {}) ⇒ Object
75 76 77 |
# File 'lib/localeapp/routes.rb', line 75 def import_url(={}) http_scheme.build(.merge(:path => import_path)).to_s end |
#missing_translations_endpoint(options = {}) ⇒ Object
60 61 62 |
# File 'lib/localeapp/routes.rb', line 60 def missing_translations_endpoint( = {}) [:post, missing_translations_url()] end |
#missing_translations_url(options = {}) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/localeapp/routes.rb', line 64 def missing_translations_url(={}) [:format] ||= 'json' url = http_scheme.build(.merge(:path => missing_translations_path([:format]))) url.query = [:query].map { |k,v| "#{k}=#{v}" }.join('&') if [:query] url.to_s end |
#project_endpoint(options = {}) ⇒ Object
7 8 9 |
# File 'lib/localeapp/routes.rb', line 7 def project_endpoint( = {}) [:get, project_url()] end |
#project_url(options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/localeapp/routes.rb', line 11 def project_url( = {}) [:format] ||= 'json' http_scheme.build(.merge(:path => project_path([:format]))).to_s end |
#remove_endpoint(options = {}) ⇒ Object
35 36 37 |
# File 'lib/localeapp/routes.rb', line 35 def remove_endpoint( = {}) [:delete, remove_url()] end |
#remove_url(options = {}) ⇒ Object
39 40 41 42 |
# File 'lib/localeapp/routes.rb', line 39 def remove_url( = {}) url = http_scheme.build(.merge(:path => remove_path([:key], [:format]))) url.to_s end |
#rename_endpoint(options = {}) ⇒ Object
44 45 46 |
# File 'lib/localeapp/routes.rb', line 44 def rename_endpoint( = {}) [:post, rename_url()] end |
#rename_url(options = {}) ⇒ Object
48 49 50 51 |
# File 'lib/localeapp/routes.rb', line 48 def rename_url( = {}) url = http_scheme.build(.merge(:path => rename_path([:current_name], [:format]))) url.to_s end |
#translations_endpoint(options = {}) ⇒ Object
23 24 25 |
# File 'lib/localeapp/routes.rb', line 23 def translations_endpoint( = {}) [:get, translations_url()] end |
#translations_url(options = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/localeapp/routes.rb', line 16 def translations_url(={}) [:format] ||= 'yml' url = http_scheme.build(.merge(:path => translations_path([:format]))) url.query = [:query].map { |k,v| "#{k}=#{v}" }.join('&') if [:query] url.to_s end |