jsonapi_swagger_helpers 0.1.4 → 0.1.5

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: daf7337cfbe10348713e75c7b6129b33652810ce
4
- data.tar.gz: c2ff7788b9b36795c4cfcfa344c0a17d79e29c2f
3
+ metadata.gz: 9b9b3f968a4f5d28cdde96e82960634eb620f152
4
+ data.tar.gz: a1a488145afdab452e203eca3301f02fb9c03e04
5
5
  SHA512:
6
- metadata.gz: 6019ce3345148d0e800039aa27f3570082d1410e5e45cd00e7031c029de01859903fe95e07a31eba817d5ebc9d6461358812b62b026b8d1754917e566ee378c3
7
- data.tar.gz: 77a7212b8bc16183ddc1b8ab59a37111a9f0e49f329e2abeac22b900197eab7fd2c793410abb275104a05874da350604a285ba61a37e493fd8bea8ca1b82ab37
6
+ metadata.gz: 85b70ab34c7a2e0dcdb0aab4aea2d9d62cdcd598772f5eb186837a9e3ab79d169024de4721fa0b4893b14e30472ec544d2e7ede0620225f88628a28703448a58
7
+ data.tar.gz: 0b33c9e6fad54818f4fcf28a8bea33692d6a51a204f11e6caa2b6b5238133ce9d3f91ccfb946d023a4d50c505afed588f44f4ed1b4d4e269b60d83474e71d171
@@ -1,3 +1,3 @@
1
1
  module JsonapiSwaggerHelpers
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -33,6 +33,7 @@ module JsonapiSwaggerHelpers
33
33
  def jsonapi_index(controller)
34
34
  jsonapi_includes(controller, :index)
35
35
  jsonapi_filters(controller)
36
+ jsonapi_stats(controller)
36
37
  jsonapi_pagination
37
38
  jsonapi_sorting
38
39
  end
@@ -73,6 +74,24 @@ module JsonapiSwaggerHelpers
73
74
  end
74
75
  end
75
76
 
77
+ def jsonapi_stats(controller)
78
+ controller._jsonapi_compliable.stats.each_pair do |stat_name, opts|
79
+ calculations = opts.calculations.keys - [:keys]
80
+ calculations = calculations.join('<br/>')
81
+ parameter do
82
+ key :name, "stats[#{stat_name}]"
83
+ key :in, :query
84
+ key :type, :string
85
+ key :required, false
86
+ key :description, "<a href='http://jsonapi.org/format/#document-meta'>JSONAPI meta data</a><br/> #{calculations}"
87
+
88
+ items do
89
+ key :model, :string
90
+ end
91
+ end
92
+ end
93
+ end
94
+
76
95
  def jsonapi_pagination
77
96
  parameter do
78
97
  key :name, "page[size]"
@@ -113,7 +132,7 @@ module JsonapiSwaggerHelpers
113
132
  key :in, :query
114
133
  key :type, :string
115
134
  key :required, false
116
- key :description, "<a href='http://jsonapi.org/format/#fetching-includes'>JSONAPI includes</a>: #{includes}"
135
+ key :description, "<a href='http://jsonapi.org/format/#fetching-includes'>JSONAPI includes</a>: <br/> #{includes}"
117
136
  end
118
137
  end
119
138
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_swagger_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: swagger-blocks