apipie-rails 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/app/views/layouts/apipie/apipie.html.erb +1 -1
- data/config/locales/fr.yml +31 -0
- data/lib/apipie/version.rb +1 -1
- metadata +3 -3
- data/lib/apipie/client/generator.rb +0 -135
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37c0e129d50ee2ead759ed4b2ce84fa78ad8b5e0
|
4
|
+
data.tar.gz: f5576d4598603160aa7624578d62aabdccde8ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a8f76dd307fc2fa62825a90ecf5e8c7016a9abb5649cfa79b7d4346102d5f442d3a8ecbfdf603239bd956260fb8d9c117b73c77d536491ed538b38e04ade1b
|
7
|
+
data.tar.gz: 2687e565d29cf0be95eb232d8b8ab015c6378eff0ae42bf36459d10ad3836447343333e7730bb8389ee003e380063788b515cdaac9012112c0de1b5de217a35e
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
v0.5.6
|
5
|
+
------
|
6
|
+
|
7
|
+
- Prevent missing translation span in title [\#571](https://github.com/Apipie/apipie-rails/pull/571) ([mbacovsky](https://github.com/mbacovsky))
|
8
|
+
- Clean up old generator code for CLI [\#572](https://github.com/Apipie/apipie-rails/pull/572) ([voxik](https://github.com/voxik))
|
9
|
+
- Added french locale [\#568](https://github.com/Apipie/apipie-rails/pull/568) ([giglemad](https://github.com/giglemad))
|
10
|
+
|
4
11
|
v0.5.5
|
5
12
|
------
|
6
13
|
|
7
|
-
- prevent lang in url when config.translate is false [
|
8
|
-
- Allow for resource-level deprecations [
|
14
|
+
- prevent lang in url when config.translate is false [\#562](https://github.com/Apipie/apipie-rails/pull/562) ([markmoser](https://github.com/markmoser))
|
15
|
+
- Allow for resource-level deprecations [\#567](https://github.com/Apipie/apipie-rails/pull/567) ([cross-p6](https://github.com/cross-p6))
|
9
16
|
|
10
17
|
v0.5.4
|
11
18
|
------
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title><%= t('apipie.api_documentation') %></title>
|
4
|
+
<title><%= t('apipie.api_documentation', :default => 'Api Documentation') %></title>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
7
|
<%= Apipie.include_stylesheets %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
fr:
|
2
|
+
apipie:
|
3
|
+
resources: Ressources
|
4
|
+
resource: Ressource
|
5
|
+
description: Description
|
6
|
+
no_docs_found: Aucune documentation trouvée
|
7
|
+
no_docs_found_descr: Aucune documentation pour cette API
|
8
|
+
follow_instructions_html: Suivez ces %{href} sur la façon dont décrire vos controlleurs.
|
9
|
+
follow_instructions_href: instructions supplémentaires
|
10
|
+
oops: Oops!!
|
11
|
+
resource_not_found_html: Ressource %{resource} not found.
|
12
|
+
method_not_found_html: Méthode %{method} non trouvée pour la ressource %{resource}.
|
13
|
+
goto_homepage_html: Essayez de regarder %{href}
|
14
|
+
goto_homepage_href: "la page d'accueil %{app_name} API documentation homepage"
|
15
|
+
required: requis
|
16
|
+
optional: optionel
|
17
|
+
nil_allowed: nil autorisé
|
18
|
+
param_name: Nom du paramètre
|
19
|
+
params: Paramètres
|
20
|
+
examples: Exemples
|
21
|
+
metadata: Metadata
|
22
|
+
errors: Erreurs
|
23
|
+
error_code: Code
|
24
|
+
error_description: Description
|
25
|
+
error_metadata: Metadata
|
26
|
+
supported_formats: Formats supportés
|
27
|
+
enable_javascript_html: Activez JavaScript SVP pour afficher la %{comments_href}.
|
28
|
+
comments_powered_by_disqus: section commentaires par %{disqus}
|
29
|
+
api_documentation: documentation API
|
30
|
+
headers: Headers
|
31
|
+
header_name: Nom du header
|
data/lib/apipie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- config/locales/de.yml
|
178
178
|
- config/locales/en.yml
|
179
179
|
- config/locales/es.yml
|
180
|
+
- config/locales/fr.yml
|
180
181
|
- config/locales/it.yml
|
181
182
|
- config/locales/ja.yml
|
182
183
|
- config/locales/pl.yml
|
@@ -190,7 +191,6 @@ files:
|
|
190
191
|
- lib/apipie-rails.rb
|
191
192
|
- lib/apipie/apipie_module.rb
|
192
193
|
- lib/apipie/application.rb
|
193
|
-
- lib/apipie/client/generator.rb
|
194
194
|
- lib/apipie/configuration.rb
|
195
195
|
- lib/apipie/dsl_definition.rb
|
196
196
|
- lib/apipie/error_description.rb
|
@@ -1,135 +0,0 @@
|
|
1
|
-
#!/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'thor'
|
5
|
-
require 'thor/group'
|
6
|
-
require 'fileutils'
|
7
|
-
require 'active_support/inflector'
|
8
|
-
require 'apipie/client/base'
|
9
|
-
|
10
|
-
module Apipie
|
11
|
-
module Client
|
12
|
-
|
13
|
-
class Generator < Thor::Group
|
14
|
-
include Thor::Actions
|
15
|
-
|
16
|
-
# Define arguments and options
|
17
|
-
argument :name
|
18
|
-
argument :subject
|
19
|
-
argument :suffix
|
20
|
-
argument :version
|
21
|
-
|
22
|
-
attr_reader :doc, :resource, :resource_key
|
23
|
-
|
24
|
-
def initialize(*args)
|
25
|
-
super
|
26
|
-
@doc = Apipie.to_json(version)[:docs]
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.source_root
|
30
|
-
File.expand_path("../template", __FILE__)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.destination_root(name, suffix)
|
34
|
-
File.join(FileUtils.pwd, "#{name}#{suffix}")
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.start(client_name, subject = :all, suffix = '_client', version = nil)
|
38
|
-
name = client_name.parameterize.underscore
|
39
|
-
suffix = suffix.parameterize.underscore
|
40
|
-
super([name, subject, suffix, version], :destination_root => destination_root(name, suffix))
|
41
|
-
end
|
42
|
-
|
43
|
-
def all?
|
44
|
-
subject == :all
|
45
|
-
end
|
46
|
-
|
47
|
-
def generate_cli
|
48
|
-
full_name = "#{name}#{suffix}"
|
49
|
-
template("README.tt", "README")
|
50
|
-
template("Gemfile.tt", "Gemfile")
|
51
|
-
template("Rakefile.tt", "Rakefile")
|
52
|
-
template("a_name.gemspec.tt", "#{full_name}.gemspec")
|
53
|
-
template("lib/a_name.rb.tt", "lib/#{full_name}.rb")
|
54
|
-
template("lib/a_name/version.rb.tt", "lib/#{full_name}/version.rb")
|
55
|
-
create_file "lib/#{full_name}/documentation.json", JSON.dump(Apipie.to_json)
|
56
|
-
copy_file "lib/a_name/config.yml", "lib/#{full_name}/config.yml"
|
57
|
-
if all?
|
58
|
-
template("bin/bin.rb.tt", "bin/#{full_name}")
|
59
|
-
chmod("bin/#{full_name}", 0755)
|
60
|
-
end
|
61
|
-
doc[:resources].each do |key, resource|
|
62
|
-
@resource_key, @resource = key, resource
|
63
|
-
if all?
|
64
|
-
template("lib/a_name/commands/cli.rb.tt", "lib/#{full_name}/commands/#{resource_name}.thor")
|
65
|
-
end
|
66
|
-
template("lib/a_name/resources/resource.rb.tt", "lib/#{full_name}/resources/#{resource_name}.rb")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
protected
|
71
|
-
|
72
|
-
def camelizer(string)
|
73
|
-
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
74
|
-
string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$2.capitalize}" }
|
75
|
-
end
|
76
|
-
|
77
|
-
def class_base
|
78
|
-
@class_base ||= camelizer(name)
|
79
|
-
end
|
80
|
-
|
81
|
-
def class_suffix
|
82
|
-
@class_suffix ||= camelizer(suffix)
|
83
|
-
end
|
84
|
-
|
85
|
-
def plaintext(text)
|
86
|
-
text.gsub(/<.*?>/, '').gsub("\n", ' ').strip
|
87
|
-
end
|
88
|
-
|
89
|
-
# Resource related helper methods:
|
90
|
-
|
91
|
-
def resource_name
|
92
|
-
resource[:name].gsub(/\s/, "_").downcase.singularize
|
93
|
-
end
|
94
|
-
|
95
|
-
def api(method)
|
96
|
-
method[:apis].first
|
97
|
-
end
|
98
|
-
|
99
|
-
def params_in_path(method)
|
100
|
-
api(method)[:api_url].scan(/:([^\/]*)/).map(&:first)
|
101
|
-
end
|
102
|
-
|
103
|
-
def client_args(method)
|
104
|
-
params_in_path(method).dup
|
105
|
-
end
|
106
|
-
|
107
|
-
def substituted_url(method)
|
108
|
-
params_in_path(method).reduce(api(method)[:api_url]) { |u, p| u.sub(":#{p}", "\#{#{p}}") }
|
109
|
-
end
|
110
|
-
|
111
|
-
def transformation_hash(method)
|
112
|
-
method[:params].find_all { |p| p[:expected_type] == "hash" && !p[:params].nil? }.reduce({ }) do |h, p|
|
113
|
-
h.update(p[:name] => p[:params].map { |pp| pp[:name] })
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def validation(method)
|
118
|
-
stringify = lambda do |object|
|
119
|
-
case object
|
120
|
-
when Hash
|
121
|
-
clone = object.dup
|
122
|
-
object.keys.each { |key| clone[key.to_s] = stringify[clone.delete(key)] }
|
123
|
-
clone
|
124
|
-
when Array
|
125
|
-
object.map { |value| stringify[value] }
|
126
|
-
else
|
127
|
-
object
|
128
|
-
end
|
129
|
-
end
|
130
|
-
Apipie::Client::Base.construct_validation_hash(stringify[method])
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
end
|
135
|
-
end
|