Module: Localeapp::Routes

Included in:
ApiCaller, Sender
Defined in:
lib/localeapp/routes.rb

Constant Summary collapse

VERSION =
'v1'

Instance Method Summary collapse

Instance Method Details

#create_translation_endpoint(options = {}) ⇒ Object



25
26
27
# File 'lib/localeapp/routes.rb', line 25

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

#import_endpoint(options = {}) ⇒ Object



40
41
42
# File 'lib/localeapp/routes.rb', line 40

def import_endpoint(options = {})
  [:post, import_url(options)]
end

#import_url(options = {}) ⇒ Object



44
45
46
# File 'lib/localeapp/routes.rb', line 44

def import_url(options={})
  http_scheme.build(base_options.merge(:path => import_path)).to_s
end

#missing_translations_endpoint(options = {}) ⇒ Object



29
30
31
# File 'lib/localeapp/routes.rb', line 29

def missing_translations_endpoint(options = {})
  [:post, missing_translations_url(options)]
end

#missing_translations_url(options = {}) ⇒ Object



33
34
35
36
37
38
# File 'lib/localeapp/routes.rb', line 33

def missing_translations_url(options={})
  options[:format] ||= 'json'
  url = http_scheme.build(base_options.merge(:path => missing_translations_path(options[:format])))
  url.query = options[:query].map { |k,v| "#{k}=#{v}" }.join('&') if options[:query]
  url.to_s
end

#project_endpoint(options = {}) ⇒ Object



5
6
7
# File 'lib/localeapp/routes.rb', line 5

def project_endpoint(options = {})
  [:get, project_url(options)]
end

#project_url(options = {}) ⇒ Object



9
10
11
12
# File 'lib/localeapp/routes.rb', line 9

def project_url(options = {})
  options[:format] ||= 'json'
  http_scheme.build(base_options.merge(:path => project_path(options[:format]))).to_s
end

#translations_endpoint(options = {}) ⇒ Object



21
22
23
# File 'lib/localeapp/routes.rb', line 21

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

#translations_url(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/localeapp/routes.rb', line 14

def translations_url(options={})
  options[:format] ||= 'json'
  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