Class: Dependabot::Clients::GithubRelease

Inherits:
T::ImmutableStruct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/clients/github_release.rb

Overview

Typed view over the release fields returned by Octokit.

Class Method Summary collapse

Class Method Details

.from_resource(resource) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dependabot/clients/github_release.rb', line 23

def self.from_resource(resource)
  tag_name = T.cast(resource[:tag_name], Object)
  return unless tag_name.is_a?(String)

  id = T.cast(resource[:id], Object)
  prerelease = T.cast(resource[:prerelease], Object)

  new(
    id: id.is_a?(Integer) ? id : nil,
    name: string_value(resource, :name),
    tag_name: tag_name,
    body: string_value(resource, :body),
    html_url: string_value(resource, :html_url),
    prerelease: prerelease == true,
    published_at: time_value(resource, :published_at)
  )
end