Class: Fitting::Skip::API
- Inherits:
-
Object
- Object
- Fitting::Skip::API
- Defined in:
- lib/fitting/skip/api.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, host, prefix) ⇒ API
constructor
A new instance of API.
Constructor Details
#initialize(type, host, prefix) ⇒ API
Returns a new instance of API.
6 7 8 9 10 |
# File 'lib/fitting/skip/api.rb', line 6 def initialize(type, host, prefix) @type = type @host = host @prefix = prefix end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
4 5 6 |
# File 'lib/fitting/skip/api.rb', line 4 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/fitting/skip/api.rb', line 4 def path @path end |
#prefix ⇒ Object
Returns the value of attribute prefix.
4 5 6 |
# File 'lib/fitting/skip/api.rb', line 4 def prefix @prefix end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/fitting/skip/api.rb', line 4 def type @type end |
Class Method Details
.all(apis) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/fitting/skip/api.rb', line 12 def self.all(apis) return [] unless apis apis.map do |api| next if api['method'] || api['path'] new('provided', api['host'], api['prefix']) end.compact end |
.find(apis, log) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/fitting/skip/api.rb', line 20 def self.find(apis, log) apis.find do |api| if log.host == api.host api.prefix.nil? || api.prefix == '' || log.path[0..api.prefix.size - 1] == api.prefix end end end |