yard-api 0.3.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3af67e45e3ab8fd41ef0ec5cb1578e1978361579796e4d2720f9a09907ded38
4
- data.tar.gz: 488360b56b9a807e8e6a8671b3aeae13b83f3400d01cf6f826b0cbdf9881337b
3
+ metadata.gz: 031c5ccb5ac18f138c9853c00ac39135cbc8f5fa744a5fd7a0c1c31370202904
4
+ data.tar.gz: 71a71e187577a8797d7d41b726b3b3aa64a7effbbfebb8fc4410d41fd3169cd0
5
5
  SHA512:
6
- metadata.gz: b1dfd66a16c6e4a1d76a121b2fc74ab9cd813e1336bb51ef36b6c54d9baea7e39fff89cb125759f784cb18d629259d340e655010a32f4709b85e43f92529f936
7
- data.tar.gz: 85b89092da99271aad2c5b09b77ee32d5b1b93e25493ed16682263bed6cd3175c24c8ff21a4d3507fad9e3a5414b09079bae5c4bb095c3db4c0675a5a27bffdb
6
+ metadata.gz: f484a14b069cacfd7d96af521c68ca11bcf4304348ea83b80e0f19ce966c143a3fcea2e0c16ab639a5769bb91358ef1ebb3e4bc131e5369dcb940f8ba37f8d3e
7
+ data.tar.gz: e8e20607a65b8ed3a432a21d1e08e7a5db512707f3d6dca37b1acf1c8285661f2afa7acae812c9543cb211df29d10e83803511a66322de16c9797cee8b006df1
data/README.md CHANGED
@@ -40,65 +40,7 @@ Read that file to view all the available options.
40
40
 
41
41
  ## Changelog
42
42
 
43
- **6/9/2015 [0.3.5]**
44
-
45
- - In JSON format, an API resource endpoint now contains the name as well.
46
- - Changed the `topicize()` helper in a way that makes the IDs (and URLs of
47
- some sections) much more readable
48
-
49
- **23/8/2015 [0.3.4]**
50
-
51
- - Fixed an issue that prevented overriding the Rake task's options at runtime.
52
- - Updated `config/yard_api.yml` to reflect the recently added options.
53
-
54
- **17/8/2015 [0.3.3]**
55
-
56
- - Improved the JSON format's output to be more concise and consistent.
57
-
58
- **30/7/2015 [0.3.1]**
59
-
60
- - Fixed a bug that was listing all the endpoints of a certain controller even if they do not have a route defined. Now, YARD-API will warn about endpoints that have an `@API` tag but could not be routed.
61
- - Greatly improved the performance of generating the Quicklinks table.
62
-
63
- **29/7/2015 [0.3.0]**
64
-
65
- - major rework of the linking logic, much improvements but some stuff is broken now
66
-
67
- **28/7/2015 [0.2.3]**
68
-
69
- - dropped the `@argument_scope` tag
70
- - JSON is available as an output format now
71
- - added usage documentation, found at [http://amireh.github.io/yard-api]
72
- - added an example app
73
- - various style improvements
74
- - `@example_request` is now able to output a sample cURL command.
75
-
76
- **0.1.7**
77
-
78
- - new compatibility option `leading_argument_name_fix`
79
-
80
- **15/9/2014**
81
-
82
- - `@argument` tags can now be formatted in a table by setting the `tabular_arguments` option to true
83
- - `@argument_scope`: a new tag that improves the formatting of endpoint arguments that are scoped by a common prefix (e.g, nested inside a json object), like `user[name]` => `name`
84
- - `@argument` can now parse accepted values in two formats; inline within the types array, or by explicitly writing it in the tag text using any of `Accepted values: [...]`, `Accepts: [...]`, or `Possible values: [...]`
85
- - A new option: `strict_arguments` that provides a default for the `is_required` property of `@argument` tags. This default is used if the tag does not explicitly state `Optional` or `Required` in its type specifier.
86
- - Support for dynamic javascript and style code based on options. See `templates/layout/setup.rb#inline_{javascripts,stylesheets}`
87
- - A new set of options for customizing layout: `content_width`, `sidebar_width` and `spacer`
88
- - `github_url` and `github_branch` options for tuning api endpoint source links
89
-
90
- **14/9/2014**
91
-
92
- - Support for single-page output through the `one_file` option
93
- - Support for resource index generation ("All Resources") through the `resource_index` option
94
-
95
- **10/9/2014**
96
-
97
- - Support for github-flavored markdown when you're using Markdown as a markup, and `redcarpet` as the provider
98
- - Syntax highlighting for multiple languages (with auto-detection) using [highlight.js](https://highlightjs.org/)
99
- - `@example_response` and `@example_request` tags now support a title for the response
100
- - A new option: `copyright` for displaying a copyright in the footer of every page
101
- - A new option: `footer_note` for displaying a custom note, like linking to the project's source code, in the footer of every page
43
+ See CHANGES.md.
102
44
 
103
45
  ## License
104
46
 
@@ -31,8 +31,17 @@ module YARD::Templates::Helpers
31
31
  end
32
32
 
33
33
  def get_route_verb(route)
34
- route.verb.source =~ /\^?(\w*)\$/ ? $1.upcase : route.verb.source
34
+ verb = route.verb
35
+
36
+ case verb
37
+ when Regexp
38
+ verb.source =~ /\^?(\w*)\$/ ? $1.upcase : verb.source
39
+ when String
40
+ verb
41
+ else
42
+ "???"
43
+ end
35
44
  end
36
45
  end
37
46
  end
38
- end
47
+ end
@@ -1,5 +1,5 @@
1
1
  module YARD
2
2
  module APIPlugin
3
- VERSION = "0.3.7"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -55,7 +55,22 @@ def dump_object(obj)
55
55
  is_required = prop.has_key?('required') ? prop['required'] : false
56
56
  is_required_str = is_required ? 'Required' : 'Optional'
57
57
 
58
- ArgumentTag.new(nil, "[#{is_required_str}, #{prop['type']}] #{prop_name}\n #{prop['description']}")
58
+ {
59
+ "name" => prop_name,
60
+ "types" => Array(prop["type"]),
61
+ "is_required" => !!prop["required"],
62
+ "text" => prop.fetch('description', ''),
63
+ "example" => prop['example'],
64
+ "accepted_values" => Array(
65
+ first_in([
66
+ "accepted values",
67
+ "accepted_values",
68
+ "accepts",
69
+ "accepted",
70
+ "acceptable values",
71
+ ], prop)
72
+ )
73
+ }
59
74
  end
60
75
 
61
76
  {
@@ -64,7 +79,7 @@ def dump_object(obj)
64
79
  title: title,
65
80
  text: spec['description'] || '',
66
81
  controller: obj.object.path,
67
- schema: schema_tags.as_json.map { |e| e.delete('tag_name'); e }
82
+ schema: schema_tags
68
83
  }
69
84
  end
70
85
 
@@ -126,3 +141,7 @@ def get_route(object)
126
141
  }
127
142
  end
128
143
  end
144
+
145
+ def first_in(keys, obj)
146
+ obj[keys.detect { |k| obj.key?(k) }]
147
+ end
data/yard-api.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  ['LICENSE', 'README.md', '.rspec', __FILE__]
16
16
  s.has_rdoc = 'yard'
17
17
  s.license = 'AGPL-3.0'
18
- s.add_dependency 'yard', '0.8.7'
18
+ s.add_dependency 'yard', '~> 0.9.15'
19
19
  s.add_dependency 'yard-appendix', '~> 0.1.8'
20
20
  s.add_development_dependency 'rspec', '~> 3.3'
21
21
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmad Amireh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-25 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.7
19
+ version: 0.9.15
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.7
26
+ version: 0.9.15
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard-appendix
29
29
  requirement: !ruby/object:Gem::Requirement