Class: CloudRailSi::Types::CreditCard

Inherits:
SandboxObject show all
Includes:
Comparable
Defined in:
lib/cloudrail_si/types/CreditCard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SandboxObject

#get, #set

Constructor Details

#initialize(cvc, expire_month, expire_year, number, type, first_name, last_name, address) ⇒ CreditCard

Returns a new instance of CreditCard.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cloudrail_si/types/CreditCard.rb', line 15

def initialize(cvc, expire_month, expire_year, number, type, first_name, last_name, address)
    super()
    @cvc = cvc
    @expire_month = expire_month
    @expire_year = expire_year
    @number = number
    @type = type
    @firstName = first_name
    @lastName = last_name
    @address = address
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def address
  @address
end

#cvcObject

Returns the value of attribute cvc.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def cvc
  @cvc
end

#expire_monthObject

Returns the value of attribute expire_month.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def expire_month
  @expire_month
end

#expire_yearObject

Returns the value of attribute expire_year.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def expire_year
  @expire_year
end

#firstNameObject

Returns the value of attribute firstName.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def firstName
  @firstName
end

#lastNameObject

Returns the value of attribute lastName.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def lastName
  @lastName
end

#numberObject

Returns the value of attribute number.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def number
  @number
end

#typeObject

Returns the value of attribute type.



13
14
15
# File 'lib/cloudrail_si/types/CreditCard.rb', line 13

def type
  @type
end

Instance Method Details

#<=>(obj) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cloudrail_si/types/CreditCard.rb', line 50

def <=> (obj)
    raise Errors::InternalError.new('CreditCards must only be compared with other non-nil CreditCards') if (obj.nil? || !(obj.instance_of?(CreditCard)))

    another = obj

    compare = CloudRailSi::ServiceCode::Helper.compare(@firstName, another.firstName)
    return compare if (compare)

    compare = CloudRailSi::ServiceCode::Helper.compare(@lastName, another.lastName)
    return compare if (compare)

    compare = CloudRailSi::ServiceCode::Helper.compare(@number.substring[12..-1], another.number[12..-1])
    return compare if (compare)

    compare = CloudRailSi::ServiceCode::Helper.compare(@expire_month, another.expire_month)
    return compare if (compare)

    compare = CloudRailSi::ServiceCode::Helper.compare(@expire_year, another.expire_year)
    return compare if (compare)

    return CloudRailSi::ServiceCode::Helper.compare(@type, another.type)
end