Sha256: 7d7e0403164cfbd123143a371b59eb39901e532199b92c5bb52025cab89e17f7

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
payment-manager-client-0.3.0 lib/payment/manager/plan_parser.rb