route_soap 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/route_soap.rb +10 -19
  3. data/route_soap_spec.rb +1 -1
  4. metadata +18 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3f0bff87e8d1ed2263a948074967c59bd8b4d5d1
4
- data.tar.gz: d4b511fe07202a1483dbd822b438ca79e6a435e6
2
+ SHA256:
3
+ metadata.gz: 1414f90d33479f31fd162c025d52ee61c8ed980b7cd6d5454842531aae17376b
4
+ data.tar.gz: 84f21b6e05e13a1ec95a512e9b92a0995c97184dc5a83974f96fff40fb69cc0b
5
5
  SHA512:
6
- metadata.gz: 364ac3a5aaeb31b3c435eb9641f93af36978d1d18b30399d1eda99939bb0770e9a8a86b92409e6566fddc1ed6aab82b4ccb9c8a1687ed9f07b1374210af22aaf
7
- data.tar.gz: e6a6f9609a9b92f0ad2fcf633c4d7aaef62452131a1f60d911fdba0deb4f433b3e6ec08e3d1844915aefaef67c9efb574b3876b97d4f411c86db5508504411ab
6
+ metadata.gz: ad3ece2cfe0b1d2169f0614e3d81f6b89eafe6f5b88e08da5bda944864d778915717b58d37a0cc39f925f56f5aa1fa0b736eb150eb655156660c5ab2843ab6ab
7
+ data.tar.gz: c74769e5cd579f50d3f0a8c9bbf2504b47bb26b7a06584f647833e6c170b6eb04a3d3c644b4f9cd20c079d05974ff1e1b0a332b7dc459a0630d7229a5405674b
data/route_soap.rb CHANGED
@@ -19,25 +19,16 @@ module RouteSoap
19
19
  class Route
20
20
  include Contracts
21
21
 
22
- BLACKLIST = [
23
- "/",
24
- "/prototypes/*id",
22
+ DEFAULT_BLACKLIST = [
25
23
  "/rails/info",
26
24
  "/rails/info/properties",
27
25
  "/rails/info/routes"
28
26
  ]
29
27
 
30
- VERBS = {
31
- /^DELETE$/ => :delete,
32
- /^GET$/ => :get,
33
- /^PATCH$/ => :patch,
34
- /^POST$/ => :post,
35
- /^PUT$/ => :put
36
- }
37
-
38
- Contract RouteLike => Route
39
- def initialize(route)
28
+ # Contract RouteLike => Route
29
+ def initialize(route, blacklist = [])
40
30
  @route = route
31
+ @blacklist = blacklist + DEFAULT_BLACKLIST
41
32
  self
42
33
  end
43
34
 
@@ -62,7 +53,7 @@ module RouteSoap
62
53
 
63
54
  Contract nil => Hash
64
55
  def required_params
65
- hash = { "format" => route.defaults[:format] }.delete_if { |_, v| v.nil? }
56
+ hash = { format: route.defaults[:format] }.delete_if { |_, v| v.nil? }
66
57
  @required_params ||= route_path.required_names.reduce(hash) do |acc, param|
67
58
  acc[param] = SecureRandom.hex(3)
68
59
  acc
@@ -71,7 +62,7 @@ module RouteSoap
71
62
 
72
63
  Contract nil => Symbol
73
64
  def verb
74
- @verb ||= VERBS[route.verb]
65
+ @verb ||= route.verb.downcase.to_sym
75
66
  end
76
67
 
77
68
  private
@@ -85,7 +76,7 @@ module RouteSoap
85
76
 
86
77
  Contract nil => Bool
87
78
  def blacklisted?
88
- BLACKLIST.include?(path)
79
+ @blacklist.include?(path)
89
80
  end
90
81
 
91
82
  Contract nil => Or[String, nil]
@@ -141,11 +132,11 @@ module RouteSoap
141
132
  class << self
142
133
  include Contracts
143
134
 
144
- Contract Or[RouterLike, nil] => Array[String]
145
- def run(router = DefaultRouter)
135
+ # Contract Or[RouterLike, nil] => Array[String]
136
+ def run(router = DefaultRouter, blacklist = [])
146
137
  Array.new.tap do |lines|
147
138
  router.routes.each do |route|
148
- Route.new(route).tap do |simple_route|
139
+ Route.new(route, blacklist).tap do |simple_route|
149
140
  lines << String(Spec.new(simple_route)) if simple_route.valid?
150
141
  end
151
142
  end
data/route_soap_spec.rb CHANGED
@@ -28,7 +28,7 @@ describe RouteSoap do
28
28
  end
29
29
 
30
30
  def verb
31
- /^GET$/
31
+ "GET"
32
32
  end
33
33
  end
34
34
 
metadata CHANGED
@@ -1,89 +1,89 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_soap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Cunningham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2020-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: contracts
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.4'
76
- - - <
76
+ - - "<"
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0.12'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0.4'
86
- - - <
86
+ - - "<"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0.12'
89
89
  description: Route spec generator
@@ -102,23 +102,21 @@ metadata: {}
102
102
  post_install_message:
103
103
  rdoc_options: []
104
104
  require_paths:
105
- - .
105
+ - "."
106
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.9.3
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.0.2
117
+ rubygems_version: 3.0.3
119
118
  signing_key:
120
119
  specification_version: 4
121
120
  summary: A little gem to assist you in keeping your routes clean.
122
121
  test_files:
123
122
  - route_soap_spec.rb
124
- has_rdoc: