Class: SnapCi::Parser

Inherits:
Object
  • Object
show all
Includes:
Translations
Defined in:
lib/snap_ci/parser.rb

Constant Summary collapse

ERROR_PARAMETERS =
{
  'result' => t('parser.error', { locale: :en }),
  'stages' => nil
}

Instance Method Summary collapse

Methods included from Translations

included

Constructor Details

#initialize(response) ⇒ Parser

Returns a new instance of Parser.



13
14
15
# File 'lib/snap_ci/parser.rb', line 13

def initialize(response)
  set_pipeline(MultiJson.load(response.body))
end

Instance Method Details

#to_parametersObject



17
18
19
20
21
22
# File 'lib/snap_ci/parser.rb', line 17

def to_parameters
  {
    status: @pipeline['result'],
    steps: @pipeline['stages']
  }
end