Sha256: 20f23ef0520662f56a73e8f47eadffac760003c0289a3e222b062e2c82461cff

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

module Elasticity

  class JobFlow

    attr_accessor :name
    attr_accessor :jobflow_id
    attr_accessor :state
    attr_accessor :steps

    def initialize
      @steps = []
    end

    class << self

      # Create a jobflow from an AWS <member> (Nokogiri::XML::Element):
      #   /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member
      def from_member_element(xml_element)
        jobflow = JobFlow.new
        jobflow.name = xml_element.xpath("./Name").text
        jobflow.jobflow_id = xml_element.xpath("./JobFlowId").text
        jobflow.state = xml_element.xpath("./ExecutionStatusDetail/State").text
        jobflow.steps = JobFlowStep.from_members_nodeset(xml_element.xpath("./Steps/member"))
        jobflow
      end

      # Create JobFlows from a collection of AWS <member> nodes (Nokogiri::XML::NodeSet):
      #   /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows
      def from_members_nodeset(members_nodeset)
        jobflows = []
        members_nodeset.each do |member|
          jobflows << from_member_element(member)
        end
        jobflows
      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elasticity-1.2.2 lib/elasticity/job_flow.rb
elasticity-1.2.1 lib/elasticity/job_flow.rb
elasticity-1.2 lib/elasticity/job_flow.rb
elasticity-1.1.1 lib/elasticity/job_flow.rb
elasticity-1.1 lib/elasticity/job_flow.rb
elasticity-1.0.1 lib/elasticity/job_flow.rb
elasticity-1.0 lib/elasticity/job_flow.rb