praxis 0.20.0 → 0.20.1

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
  SHA1:
3
- metadata.gz: 1f9e3125f14a1661de76a4f8f5af8749dcc0b2c1
4
- data.tar.gz: 5e88bc49232b9ad8dbd7c20b046c49905d14f52c
3
+ metadata.gz: 3cc6641a8ee79fff261135fc27c46987c5118963
4
+ data.tar.gz: 23e6e0f445620738409e10818044f66f923c940a
5
5
  SHA512:
6
- metadata.gz: 5f0fa85f2dbb7d145f9e56f49aa755a2dc5cf4db65db107f73c468d3b71908e832c404d1b5cc96ac55b6f8a93c9724d7ed43192cb2f5a6fe45b18f8e2ce944b9
7
- data.tar.gz: c451e56a47994d560fc3b739bc8f63a08c5f9ffb6ba7136a9b343059bb3c3e5c34c31382e8cdcf2ec2065b00d9d81ff5a7afd7da375d22a582d02eda18469369
6
+ metadata.gz: 2f956167d5bf702c127b12b632a1b4d7ac3a404088d9f1fc226c813ffcd5bb93d4c857747bcd24acd07f449fb4123240e768716c0f433182588fd33d85143682
7
+ data.tar.gz: 956e4d47a1b7fecdb9f41da2343422f1f243b777b64402fccd9fd3c2e92a0b878b2c907f7c79d39b7d38b1a81f2a8a7564fc5f80ad43acce3144d778c46c6b6f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## next
4
4
 
5
+ ## 0.20.1
6
+
7
+ * Doc generation: handle SimpleMediaTypes so that they don’t show up in the generated schemas.
8
+ * Ensure we require AS#Enumerable extension is loaded, which is required in the generator code.
9
+ * Add Date to the list of primitive types so that it does not show in the generated schemas.
10
+ * Enhance the `:created` response_template, so that it can take the associated media_type
11
+ * Doc Browser: fix route display to have the captures instead of the example
12
+
5
13
  ## 0.20.0
6
14
 
7
15
  * You can now add a `bower.json` file to your `docs` folder. Any dependencies
@@ -12,7 +12,9 @@ app.directive('requestExamples', function(Examples, $timeout) {
12
12
  var keys = _.keys(scope.examples);
13
13
  if (keys.length === 1) {
14
14
  scope.examples[keys[0]].template.then(function(templateFn) {
15
- element.empty().append(templateFn(scope));
15
+ $timeout(function() {
16
+ element.empty().append(templateFn(scope));
17
+ }, 100);
16
18
  });
17
19
  } else {
18
20
  scope.select = function(template) {
@@ -5,12 +5,11 @@ app.directive('url', function() {
5
5
  return {
6
6
  restrict: 'EA',
7
7
  scope: {
8
- action: '=',
9
- example: '@'
8
+ action: '='
10
9
  },
11
10
  templateUrl: 'views/directives/url.html',
12
11
  link: function(scope, element, attrs) {
13
- scope.showExample = scope.example == 'example' || scope.example == 'true' || 'example' in attrs;
12
+ scope.showExample = 'example' in attrs;
14
13
  }
15
14
  };
16
15
  });
@@ -98,7 +98,8 @@ module Praxis
98
98
  description 'Standard response for successful HTTP requests.'
99
99
  end
100
100
 
101
- api.response_template :created do |location: nil|
101
+ api.response_template :created do |location: nil, media_type: nil|
102
+ media_type media_type if media_type
102
103
  location location
103
104
  status 201
104
105
  description 'The request has been fulfilled and resulted in a new resource being created.'
@@ -2,6 +2,8 @@ module Praxis
2
2
  module Docs
3
3
 
4
4
  class Generator
5
+ require 'active_support/core_ext/enumerable' # For index_by
6
+
5
7
  API_DOCS_DIRNAME = 'docs/api'
6
8
 
7
9
  attr_reader :resources_by_version, :types_by_id, :infos_by_version
@@ -11,6 +13,7 @@ module Praxis
11
13
  Attributor::Boolean,
12
14
  Attributor::CSV,
13
15
  Attributor::DateTime,
16
+ Attributor::Date,
14
17
  Attributor::Float,
15
18
  Attributor::Hash,
16
19
  Attributor::Ids,
@@ -85,9 +88,9 @@ module Praxis
85
88
  when Hash
86
89
  if data.key?(:type) && data[:type].kind_of?(Hash) && ( [:id,:name,:family] - data[:type].keys ).empty?
87
90
  type_id = data[:type][:id]
88
- unless type_id.nil?
91
+ unless type_id.nil? || type_id == Praxis::SimpleMediaType.id #SimpleTypes shouldn't be collected
89
92
  unless types_by_id[type_id]
90
- raise "Error! We have detected a reference to a 'Type' which is not derived from Attributor::Type" +
93
+ raise "Error! We have detected a reference to a 'Type' with id='#{type_id}' which is not derived from Attributor::Type" +
91
94
  " Document generation cannot proceed."
92
95
  end
93
96
  reachable_types << types_by_id[type_id]
@@ -6,14 +6,20 @@ module Praxis
6
6
  # @see Praxis::MediaType
7
7
  # @see Praxis::Types::MediaTypeCommon
8
8
  SimpleMediaType = Struct.new(:identifier) do
9
+
9
10
  def name
10
11
  self.class.name
11
12
  end
12
13
 
14
+ def self.id
15
+ "Praxis-SimpleMediaType".freeze
16
+ end
17
+
13
18
  def id
14
- self.class.name.gsub("::",'-')
19
+ self.class.id
15
20
  end
16
21
 
22
+
17
23
  def describe(shallow=true)
18
24
  {name: name, family: "string", id: id, identifier: identifier}
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module Praxis
2
- VERSION = '0.20.0'
2
+ VERSION = '0.20.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: praxis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep M. Blanquer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-18 00:00:00.000000000 Z
12
+ date: 2016-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -725,7 +725,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
725
725
  version: '0'
726
726
  requirements: []
727
727
  rubyforge_project:
728
- rubygems_version: 2.4.5
728
+ rubygems_version: 2.4.5.1
729
729
  signing_key:
730
730
  specification_version: 4
731
731
  summary: Building APIs the way you want it.