Sha256: b12111b38d572339424e630822964e97286adad5e24a3186180efd481d5c1fbf
Contents?: true
Size: 761 Bytes
Versions: 4
Compression:
Stored size: 761 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: [] @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 0.0 unless price price.tr(",", ".").to_f end def transform_date date return nil unless date Time.new(date) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
correios_api-1.0.3 | lib/correios_api/rate.rb |
correios_api-1.0.2 | lib/correios_api/rate.rb |
correios_api-1.0.1 | lib/correios_api/rate.rb |
correios_api-1.0.0 | lib/correios_api/rate.rb |