Class: Pagseguro::Charge::Holder
- Inherits:
-
Object
- Object
- Pagseguro::Charge::Holder
- Defined in:
- lib/pagseguro/charge/holder.rb
Overview
Credit card data
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#brand ⇒ String
Credit card brand.
-
#email ⇒ Object
Returns the value of attribute email.
-
#exp_month ⇒ integer
Credit card expiration month.
-
#exp_year ⇒ Integer
Credit card expiration year.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Long
Credit card number.
-
#security_code ⇒ String
Credit card security_code.
-
#tax_id ⇒ Object
Returns the value of attribute tax_id.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(args = {}) ⇒ Holder
constructor
A new instance of Holder.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Holder
Returns a new instance of Holder.
16 17 18 19 20 21 |
# File 'lib/pagseguro/charge/holder.rb', line 16 def initialize(args = {}) @name = args[:name] @tax_id = args[:tax_id] @email = args[:email] @address = args[:address] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
11 12 13 |
# File 'lib/pagseguro/charge/holder.rb', line 11 def address @address end |
#brand ⇒ String
Credit card brand
10 11 12 |
# File 'lib/pagseguro/charge/holder.rb', line 10 def brand @brand end |
#email ⇒ Object
Returns the value of attribute email.
11 12 13 |
# File 'lib/pagseguro/charge/holder.rb', line 11 def email @email end |
#exp_month ⇒ integer
Credit card expiration month
10 11 12 |
# File 'lib/pagseguro/charge/holder.rb', line 10 def exp_month @exp_month end |
#exp_year ⇒ Integer
Credit card expiration year
10 11 12 |
# File 'lib/pagseguro/charge/holder.rb', line 10 def exp_year @exp_year end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/pagseguro/charge/holder.rb', line 11 def name @name end |
#number ⇒ Long
Credit card number
10 11 12 |
# File 'lib/pagseguro/charge/holder.rb', line 10 def number @number end |
#security_code ⇒ String
Credit card security_code
10 11 12 |
# File 'lib/pagseguro/charge/holder.rb', line 10 def security_code @security_code end |
#tax_id ⇒ Object
Returns the value of attribute tax_id.
11 12 13 |
# File 'lib/pagseguro/charge/holder.rb', line 11 def tax_id @tax_id end |
Class Method Details
.fill_from_json(data) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pagseguro/charge/holder.rb', line 29 def self.fill_from_json(data) return if data.nil? holder = new holder.name = data["name"] holder.tax_id = data["tax_id"] holder.email = data["email"] holder.address = Address.fill_from_json(data["address"]) holder end |
Instance Method Details
#as_json(options = {}) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/pagseguro/charge/holder.rb', line 40 def as_json(={}) { name: @name, tax_id: @tax_id, email: @email, address: @address } end |
#to_json(*options) ⇒ Object
23 24 25 26 27 |
# File 'lib/pagseguro/charge/holder.rb', line 23 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |