Sha256: ed2466ea37de51e01fdddcacd155a99f12d4bd1a5f08667b7d1548156d9bab45
Contents?: true
Size: 764 Bytes
Versions: 1
Compression:
Stored size: 764 Bytes
Contents
module CorreiosApi class Rate attr_reader :service_name, :service_code, :price, :delivery_time_in_days, :max_delivery_time, :message, :errors def initialize service_name:, service_code:, price:, delivery_time_in_days:, max_delivery_time:, message: nil, errors: nil @service_name = service_name @service_code = service_code @price = transform_price(price) @delivery_time_in_days = delivery_time_in_days @max_delivery_time = transform_date(max_delivery_time) @message = message @errors = errors end private def transform_price price return nil unless price price.gsub(",", ".").to_f end def transform_date date return nil unless date Time.new(date) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
correios_api-0.1.0 | lib/correios_api/rate.rb |