Class: Conekta::Payee

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Attributes inherited from ConektaObject

#values

Instance Method Summary collapse

Methods included from Operations::CreateMember

#create_member

Methods included from Operations::CustomAction

#custom_action

Methods included from Operations::Update

#update

Methods included from Operations::Delete

#delete, #delete_member

Methods included from Operations::Create

included

Methods included from Operations::Where

handle_type_of_paging, included

Methods included from Operations::Find

included

Methods inherited from Resource

#_url, _url, #create_member_with_relation, #initialize, underscored_class

Methods inherited from ConektaObject

class_name, #class_name, #create_attr, #first, #initialize, #inspect, #last, #set_val, #to_s, #unset_key

Constructor Details

This class inherits a constructor from Conekta::Resource

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def created_at
  @created_at
end

#default_destination_idObject

Returns the value of attribute default_destination_id.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def default_destination_id
  @default_destination_id
end

#emailObject

Returns the value of attribute email.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def email
  @email
end

#livemodeObject

Returns the value of attribute livemode.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def livemode
  @livemode
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



11
12
13
# File 'lib/conekta/payee.rb', line 11

def phone
  @phone
end

Instance Method Details

#create_destination(params) ⇒ Object



41
42
43
44
# File 'lib/conekta/payee.rb', line 41

def create_destination(params)
  raise_version_error("2.0.0") if Conekta.api_version <= "1.0.0"
  self.create_member('destinations', params)
end

#create_payout_method(params) ⇒ Object



36
37
38
39
# File 'lib/conekta/payee.rb', line 36

def create_payout_method(params)
  raise_version_error("1.0.0") if Conekta.api_version > "1.0.0"
  self.create_member('payout_methods', params)
end

#load_from(response = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/conekta/payee.rb', line 14

def load_from(response=nil)
  if response
    super
  end
  payee = self
  if Conekta.api_version <= "1.0.0"
    self.payout_methods.each do |k,v|
      if !v.respond_to? :deleted || !v.deleted
        v.create_attr('payee', payee)
        self.payout_methods.set_val(k,v)
      end
    end
  else
    self.destinations.each do |k,v|
      if !v.respond_to? :deleted || !v.deleted
        v.create_attr('payee', payee)
        self.destinations.set_val(k,v)
      end
    end
  end
end