Class: DeprecationAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/stitches/spec/show_deprecation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rspec_api_documentation_context, gone_on) ⇒ DeprecationAnalysis

Returns a new instance of DeprecationAnalysis.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/stitches/spec/show_deprecation.rb', line 3

def initialize(rspec_api_documentation_context, gone_on)
  gone_on_date = Date.parse(gone_on)
  if gone_on_date > Date.today
    @expecting_sunset      = true
    @expected_sunset_value = gone_on_date.in_time_zone("GMT").midnight.strftime("%a, %e %b %Y %H:%M:%S %Z")
    @sunset_header_set     = rspec_api_documentation_context.response_headers["Sunset"].present?
    @sunset_value          = rspec_api_documentation_context.response_headers["Sunset"]
    @sunset_header_match   = @expected_sunset_value == @sunset_value
  else
    @expecting_gone = true
    @status         = rspec_api_documentation_context.status
    @gone           = @status == 410
  end
end

Instance Attribute Details

#expected_sunset_valueObject (readonly)

Returns the value of attribute expected_sunset_value.



2
3
4
# File 'lib/stitches/spec/show_deprecation.rb', line 2

def expected_sunset_value
  @expected_sunset_value
end

#statusObject (readonly)

Returns the value of attribute status.



2
3
4
# File 'lib/stitches/spec/show_deprecation.rb', line 2

def status
  @status
end

#sunset_valueObject (readonly)

Returns the value of attribute sunset_value.



2
3
4
# File 'lib/stitches/spec/show_deprecation.rb', line 2

def sunset_value
  @sunset_value
end

Instance Method Details

#expecting_sunset?Boolean

Returns:

  • (Boolean)


18
# File 'lib/stitches/spec/show_deprecation.rb', line 18

def expecting_sunset?;    !!@expecting_sunset;    end

#gone?Boolean

Returns:

  • (Boolean)


21
# File 'lib/stitches/spec/show_deprecation.rb', line 21

def gone?;                !!@gone;                end

#sunset_header_match?Boolean

Returns:

  • (Boolean)


20
# File 'lib/stitches/spec/show_deprecation.rb', line 20

def sunset_header_match?; !!@sunset_header_match; end

#sunset_header_set?Boolean

Returns:

  • (Boolean)


19
# File 'lib/stitches/spec/show_deprecation.rb', line 19

def sunset_header_set?;   !!@sunset_header_set;   end