Sha256: 8a5cf7d19c5214bedb6e0e1a8d28884954d05e848c91bdf28f304fca24820245
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
# frozen_string_literal: true module FriendlyShipping # Represents a carrier (UPS, FedEx, etc.) and its {ShippingMethod} objects. class Carrier # @return [String] a unique identifier for this carrier attr_reader :id # @return [String] the carrier's name attr_reader :name # @return [String] the carrier's unique code attr_reader :code # @return [Array<ShippingMethod>] the shipping methods available on this carrier attr_reader :shipping_methods # @return [Float] the remaining balance for this carrier attr_reader :balance # @return [Hash] additional data related to this carrier attr_reader :data # @param id [Integer, String] a unique identifier for this carrier # @param name [String] the carrier's name # @param code [String] the carrier's unique code # @param shipping_methods [Array<ShippingMethod>] the shipping methods available on this carrier # @param balance [Float] the remaining balance for this carrier # @param data [Hash] additional data related to this carrier def initialize(id: nil, name: nil, code: nil, shipping_methods: [], balance: nil, data: {}) @id = id @name = name @code = code @shipping_methods = shipping_methods @balance = balance @data = data end # Returns true if the given object shares the same ID with this carrier. # @param [Object] other # @return [Boolean] def ==(other) id == other.id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
friendly_shipping-0.9.0 | lib/friendly_shipping/carrier.rb |