Class: NotifyClass
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- NotifyClass
- Defined in:
- lib/schema.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 |
# File 'lib/schema.rb', line 1426 def self.from_dynamic!(d) d = Types::Hash[d] new( basecamp_campfire: d["basecamp_campfire"], notify_if: d["if"], slack: d["slack"] ? Slack5.from_dynamic!(d["slack"]) : nil, github_commit_status: d["github_commit_status"] ? GithubCommitStatus2.from_dynamic!(d["github_commit_status"]) : nil, github_check: Types::Hash.optional[d["github_check"]]&.transform_values { |v| Types::Any[v] } ) end |
.from_json!(json) ⇒ Object
1437 1438 1439 |
# File 'lib/schema.rb', line 1437 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1441 1442 1443 1444 1445 1446 1447 1448 1449 |
# File 'lib/schema.rb', line 1441 def to_dynamic { "basecamp_campfire" => basecamp_campfire, "if" => notify_if, "slack" => slack&.to_dynamic, "github_commit_status" => github_commit_status&.to_dynamic, "github_check" => github_check } end |
#to_json(options = nil) ⇒ Object
1451 1452 1453 |
# File 'lib/schema.rb', line 1451 def to_json( = nil) JSON.generate(to_dynamic, ) end |