Class: ApolloDeploySignalSdkRails::AdvisorReportResponse

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

Overview

Schema type: AdvisorReportResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_id:, generated_at:, score:, recommendations:) ⇒ AdvisorReportResponse

Returns a new instance of AdvisorReportResponse.

Parameters:

  • project_id (String)

    , generated_at [String], score [Integer], recommendations [Array]



1611
1612
1613
1614
1615
1616
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1611

def initialize(project_id: , generated_at: , score: , recommendations: )
  @project_id = project_id
  @generated_at = generated_at
  @score = score
  @recommendations = recommendations
end

Instance Attribute Details

#generated_atString

Returns:

  • (String)


1604
1605
1606
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1604

def generated_at
  @generated_at
end

#project_idString

Returns:

  • (String)


1602
1603
1604
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1602

def project_id
  @project_id
end

#recommendationsArray<AdvisorRecommendationResponse>

Returns:



1608
1609
1610
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1608

def recommendations
  @recommendations
end

#scoreInteger

Returns:

  • (Integer)


1606
1607
1608
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1606

def score
  @score
end

Class Method Details

.from_json(attributes) ⇒ AdvisorReportResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1631

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

  new(
    project_id: attributes.key?("projectId") ? attributes["projectId"] : attributes[:project_id],
    generated_at: attributes.key?("generatedAt") ? attributes["generatedAt"] : attributes[:generated_at],
    score: attributes.key?("score") ? attributes["score"] : attributes[:score],
    recommendations: attributes.key?("recommendations") ? attributes["recommendations"] : attributes[:recommendations],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



1619
1620
1621
1622
1623
1624
1625
1626
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1619

def to_h
  {
    project_id: @project_id,
    generated_at: @generated_at,
    score: @score,
    recommendations: @recommendations,
  }.compact
end