Sha256: 78cce48fcb6e1f0f302dd5be63d9a6dc560cf40ef7f477fefa0a99bb2dab5e40

Contents?: true

Size: 620 Bytes

Versions: 17

Compression:

Stored size: 620 Bytes

Contents

module Fedex
  module Helpers

    private
    # String or :symbol to CamelCase
    def camelize(s)
      # s.to_s.split('_').map { |e| e.capitalize }.join('')
      s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
    end

    # Helper method to validate required fields
    def requires!(hash, *params)
       params.each { |param| raise RateError, "Missing Required Parameter #{param}" if hash[param].nil? }
    end

    def underscorize(key) #:nodoc:
      key.to_s.sub(/^(v[0-9]+|ns):/, "").gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
fedex-3.10.11 lib/fedex/helpers.rb
fedex-3.10.1 lib/fedex/helpers.rb
fedex-3.10.0 lib/fedex/helpers.rb
fedex-3.9.1 lib/fedex/helpers.rb
fedex-3.9.0 lib/fedex/helpers.rb
fedex-3.8.0 lib/fedex/helpers.rb
fedex-3.6.1 lib/fedex/helpers.rb
fedex-3.6.0 lib/fedex/helpers.rb
fedex-3.4.0 lib/fedex/helpers.rb
fedex-3.3.1 lib/fedex/helpers.rb
fedex-3.3.0 lib/fedex/helpers.rb
fedex-3.1.0 lib/fedex/helpers.rb
fedex-3.0.0 lib/fedex/helpers.rb
fedex-2.2.2 lib/fedex/helpers.rb
ShippingInfo-2.0 lib/fedex/helpers.rb
fedex-2.2.1 lib/fedex/helpers.rb
fedex-2.2.0 lib/fedex/helpers.rb