Sha256: 4c7e95bcae0b82025c7c82f6af47256af97622e0b9cc6e72b29807ab34a68051
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
module PagSeguro class Sender attr_accessor :name, :email, :phone_ddd, :phone_number def initialize(options = {}) @name = options[:name] @email = options[:email] @phone_ddd = options[:phone_ddd] @phone_number = options[:phone_number] end def email valid_email? ? @email : nil end def valid_email? @email =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i && @email.size <= 60 end def name return nil unless valid_name? @name[0..49] end def valid_name? @name =~ /\S+ \S+/ end def phone_ddd @phone_ddd if @phone_ddd =~ /^\d{2}$/ end def phone_number @phone_number if @phone_number =~/^\d{8,9}$/ end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pag_seguro-0.3.0 | lib/pag_seguro/sender.rb |
pag_seguro-0.2.3 | lib/pag_seguro/sender.rb |
pag_seguro-0.2.2 | lib/pag_seguro/sender.rb |