Class: Paggi::Customer

Inherits:
Resource show all
Includes:
Rest::Create, Rest::Update
Defined in:
lib/paggi/customer.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#created, #errors, #id

Instance Method Summary collapse

Methods included from Rest::Update

included, #update

Methods included from Rest::Create

#create, included

Methods inherited from Resource

build, class_name, opts, request, url, #valid?

Constructor Details

#initialize(attributes = {}) ⇒ Customer

Returns a new instance of Customer.



8
9
10
11
# File 'lib/paggi/customer.rb', line 8

def initialize(attributes = {})
  super(attributes)
  @cards = @cards.nil? ? [] : @cards.map{ |card| Card.new(card) }
end

Instance Attribute Details

#cardsObject

Returns the value of attribute cards.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def cards
  @cards
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def description
  @description
end

#documentObject

Returns the value of attribute document.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def document
  @document
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def email
  @email
end

#metadataObject

Returns the value of attribute metadata.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



6
7
8
# File 'lib/paggi/customer.rb', line 6

def phone
  @phone
end

Instance Method Details

#to_jsonObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/paggi/customer.rb', line 13

def to_json
  super.merge!(super([
    :phone,
    :name,
    :document,
    :email,
    :metadata,
    :description,
    :cards
  ]))
end