Class: Build

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schema.rb

Overview

Properties of the build that will be created when the step is triggered

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



643
644
645
646
647
648
649
650
651
652
# File 'lib/schema.rb', line 643

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    branch: d["branch"],
    commit: d["commit"],
    env: Types::Hash.optional[d["env"]]&.transform_values { |v| Types::Any[v] },
    message: d["message"],
    meta_data: Types::Hash.optional[d["meta_data"]]&.transform_values { |v| Types::Any[v] }
  )
end

.from_json!(json) ⇒ Object



654
655
656
# File 'lib/schema.rb', line 654

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



658
659
660
661
662
663
664
665
666
# File 'lib/schema.rb', line 658

def to_dynamic
  {
    "branch" => branch,
    "commit" => commit,
    "env" => env,
    "message" => message,
    "meta_data" => 
  }
end

#to_json(options = nil) ⇒ Object



668
669
670
# File 'lib/schema.rb', line 668

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end