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
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 |
# File 'lib/schema.rb', line 1969 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
1983 1984 1985 |
# File 'lib/schema.rb', line 1983 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 |
# File 'lib/schema.rb', line 1987 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
2000 2001 2002 |
# File 'lib/schema.rb', line 2000 def to_json( = nil) JSON.generate(to_dynamic, ) end |