# frozen_string_literal: true module Payment module Manager class PlanParser def initialize(body) @json = JSON.parse(body) end def plans @json.collect do |json| Payment::Manager::Plan.new( plan(json) ) end end private def plan(json) { id: json['id'], name: json['name'], description: json['description'], price: json['price'], installments: json['installments'], duration_in_months: json['duration_in_months'], details: json['details'] } end end end end