Class: Scale::Callbacks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/scale/callbacks/base.rb

Direct Known Subclasses

Task

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/scale/callbacks/base.rb', line 6

def initialize(data)
  @json = Scale.hash(data)
  @response = json[:response]
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json.



4
5
6
# File 'lib/scale/callbacks/base.rb', line 4

def json
  @json
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/scale/callbacks/base.rb', line 4

def response
  @response
end

Class Method Details

.match?(method) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/scale/callbacks/base.rb', line 20

def self.match?(method)
  shortcut.to_s == method.to_s
end

.shortcutObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/scale/callbacks/base.rb', line 16

def self.shortcut
  raise NotImplementedError
end

Instance Method Details

#status_codeObject



11
12
13
# File 'lib/scale/callbacks/base.rb', line 11

def status_code
  response[:status_code]
end