Sha256: d2de036b2317c70cd7dfc940536c4bf320b26d003ac48482c4c231f28686001c

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

module PCPServerSDK
  module Models
    class Network
      VISA = 'VISA'.freeze
      MASTERCARD = 'MASTERCARD'.freeze
      AMEX = 'AMEX'.freeze
      GIROCARD = 'GIROCARD'.freeze
      DISCOVER = 'DISCOVER'.freeze
      JCB = 'JCB'.freeze

      def self.all_networks
        [VISA, MASTERCARD, AMEX, GIROCARD, DISCOVER, JCB]
      end

      def self.from_string(value)
        network = all_networks.find { |net| net.casecmp(value).zero? }
        raise TypeError, "'#{value}' can't represent a Network" unless network

        network
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pcp-server-ruby-sdk-1.0.0 lib/PCP-server-Ruby-SDK/models/network.rb