Class: ThreeScale::Backend::Validators::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale/backend/validators/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, params) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/3scale/backend/validators/base.rb', line 9

def initialize(status, params)
  @status = status
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



15
16
17
# File 'lib/3scale/backend/validators/base.rb', line 15

def params
  @params
end

#statusObject (readonly)

Returns the value of attribute status.



14
15
16
# File 'lib/3scale/backend/validators/base.rb', line 14

def status
  @status
end

Class Method Details

.apply(status, params) ⇒ Object



5
6
7
# File 'lib/3scale/backend/validators/base.rb', line 5

def self.apply(status, params)
  new(status, params).apply
end

Instance Method Details

#applicationObject



21
22
23
# File 'lib/3scale/backend/validators/base.rb', line 21

def application
  status.application
end

#fail!(error) ⇒ Object



29
30
31
32
# File 'lib/3scale/backend/validators/base.rb', line 29

def fail!(error)
  status.reject!(error)
  false
end

#serviceObject



17
18
19
# File 'lib/3scale/backend/validators/base.rb', line 17

def service
  @service ||= Service.load_by_id!(status.service_id)
end

#succeed!Object



25
26
27
# File 'lib/3scale/backend/validators/base.rb', line 25

def succeed!
  true
end