Sha256: 3ee770fa9cd1208a0b74dcebe1a5977c48b58d2b8d2d5808820aa17959270746

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

module Elasticity

  class JobFlowStatusStep

    attr_accessor :name
    attr_accessor :state
    attr_accessor :created_at
    attr_accessor :started_at
    attr_accessor :ended_at

    # Create a job flow from an AWS <member> (Nokogiri::XML::Element):
    #   /DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member/Steps/member
    def self.from_member_element(xml_element)
      job_flow_step = JobFlowStatusStep.new
      job_flow_step.name = xml_element.xpath('./StepConfig/Name').text.strip
      job_flow_step.state = xml_element.xpath('./ExecutionStatusDetail/State').text.strip
      created_at = xml_element.xpath('./ExecutionStatusDetail/CreationDateTime').text.strip
      job_flow_step.created_at = (created_at == '') ? (nil) : (Time.parse(created_at))
      started_at = xml_element.xpath('./ExecutionStatusDetail/StartDateTime').text.strip
      job_flow_step.started_at = (started_at == '') ? (nil) : (Time.parse(started_at))
      ended_at = xml_element.xpath('./ExecutionStatusDetail/EndDateTime').text.strip
      job_flow_step.ended_at = (ended_at == '') ? (nil) : (Time.parse(ended_at))
      job_flow_step
    end

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

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
elasticity-5.0.3 lib/elasticity/job_flow_status_step.rb
elasticity-5.0.2 lib/elasticity/job_flow_status_step.rb
elasticity-5.0.1 lib/elasticity/job_flow_status_step.rb
elasticity-4.0.5 lib/elasticity/job_flow_status_step.rb
elasticity-5.0 lib/elasticity/job_flow_status_step.rb
elasticity-4.0.4 lib/elasticity/job_flow_status_step.rb
elasticity-4.0.3 lib/elasticity/job_flow_status_step.rb
elasticity-4.0.2 lib/elasticity/job_flow_status_step.rb
elasticity-4.0.1 lib/elasticity/job_flow_status_step.rb