Class: Nucleo::Models::CheckJS

Inherits:
Object
  • Object
show all
Defined in:
lib/nucleo/models/check_js.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Nucleo::Models::SiteFeed

Returns an instanc eof the Site Feed domain model

Parameters:

  • attributes (Hash) (defaults to: {})


10
11
12
# File 'lib/nucleo/models/check_js.rb', line 10

def initialize(attributes={})
  @attributes = attributes
end

Class Method Details

.check_js(url) ⇒ Object



14
15
16
17
18
# File 'lib/nucleo/models/check_js.rb', line 14

def self.check_js(url)
  response_body = Nucleo::Requests::CheckJS.retrieve({url: url})

  self.new(response_body)
end

Instance Method Details

#body?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/nucleo/models/check_js.rb', line 20

def body?
  @attributes.fetch("body")
end

#head?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/nucleo/models/check_js.rb', line 24

def head?
  @attributes.fetch("head")
end

#installed?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/nucleo/models/check_js.rb', line 32

def installed?
  @attributes.fetch("installed")
end

#installed_correctly?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/nucleo/models/check_js.rb', line 36

def installed_correctly?
  self.head? and not (self.body? or self.other?)
end

#other?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/nucleo/models/check_js.rb', line 28

def other?
  @attributes.fetch("other")
end