Class: ApolloDeploySignalSdkRails::AdvisorRecommendationResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo_deploy_signal_sdk_rails/types.rb

Overview

Schema type: AdvisorRecommendationResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, severity:, title:, message:, data: nil) ⇒ AdvisorRecommendationResponse

Returns a new instance of AdvisorRecommendationResponse.

Parameters:

  • code (String)

    , severity [String], title [String], message [String], data [AdvisorRecommendationDataResponse, nil]



1564
1565
1566
1567
1568
1569
1570
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1564

def initialize(code: , severity: , title: , message: , data: nil)
  @code = code
  @severity = severity
  @title = title
  @message = message
  @data = data
end

Instance Attribute Details

#codeString

Returns:

  • (String)


1553
1554
1555
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1553

def code
  @code
end

#dataAdvisorRecommendationDataResponse?



1561
1562
1563
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1561

def data
  @data
end

#messageString

Returns:

  • (String)


1559
1560
1561
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1559

def message
  @message
end

#severityString

Returns:

  • (String)


1555
1556
1557
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1555

def severity
  @severity
end

#titleString

Returns:

  • (String)


1557
1558
1559
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1557

def title
  @title
end

Class Method Details

.from_json(attributes) ⇒ AdvisorRecommendationResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1586

def self.from_json(attributes)
  return nil unless attributes.is_a?(Hash)

  new(
    code: attributes.key?("code") ? attributes["code"] : attributes[:code],
    severity: attributes.key?("severity") ? attributes["severity"] : attributes[:severity],
    title: attributes.key?("title") ? attributes["title"] : attributes[:title],
    message: attributes.key?("message") ? attributes["message"] : attributes[:message],
    data: attributes.key?("data") ? attributes["data"] : attributes[:data],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



1573
1574
1575
1576
1577
1578
1579
1580
1581
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1573

def to_h
  {
    code: @code,
    severity: @severity,
    title: @title,
    message: @message,
    data: @data,
  }.compact
end