Class: BuildNotify2
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- BuildNotify2
- Defined in:
- lib/schema.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 |
# File 'lib/schema.rb', line 1967 def self.from_dynamic!(d) d = Types::Hash[d] new( basecamp_campfire: d["basecamp_campfire"], build_notify_if: d["if"], slack: d["slack"] ? Slack6.from_dynamic!(d["slack"]) : nil, github_commit_status: d["github_commit_status"] ? GithubCommitStatus3.from_dynamic!(d["github_commit_status"]) : nil, github_check: Types::Hash.optional[d["github_check"]]&.transform_values { |v| Types::Any[v] }, email: d["email"], webhook: d["webhook"], pagerduty_change_event: d["pagerduty_change_event"] ) end |
.from_json!(json) ⇒ Object
1981 1982 1983 |
# File 'lib/schema.rb', line 1981 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 |
# File 'lib/schema.rb', line 1985 def to_dynamic { "basecamp_campfire" => basecamp_campfire, "if" => build_notify_if, "slack" => slack&.to_dynamic, "github_commit_status" => github_commit_status&.to_dynamic, "github_check" => github_check, "email" => email, "webhook" => webhook, "pagerduty_change_event" => pagerduty_change_event } end |
#to_json(options = nil) ⇒ Object
1998 1999 2000 |
# File 'lib/schema.rb', line 1998 def to_json( = nil) JSON.generate(to_dynamic, ) end |