Class: Conekta::FiscalEntity

Inherits:
Resource show all
Includes:
Operations::CustomAction, Operations::Delete, Operations::Update
Defined in:
lib/conekta/fiscal_entity.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Attributes inherited from ConektaObject

#values

Instance Method Summary collapse

Methods included from Operations::CustomAction

#custom_action

Methods included from Operations::Update

#update

Methods included from Operations::Delete

#delete_member

Methods inherited from Resource

_url, #create_member_with_relation, #initialize, underscored_class

Methods inherited from ConektaObject

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

Constructor Details

This class inherits a constructor from Conekta::Resource

Instance Attribute Details

#company_nameObject

Returns the value of attribute company_name.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def company_name
  @company_name
end

#created_atObject

Returns the value of attribute created_at.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def created_at
  @created_at
end

#defaultObject

Returns the value of attribute default.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def default
  @default
end

#emailObject

Returns the value of attribute email.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def email
  @email
end

#parent_idObject

Returns the value of attribute parent_id.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def parent_id
  @parent_id
end

#phoneObject

Returns the value of attribute phone.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def phone
  @phone
end

#tax_idObject

Returns the value of attribute tax_id.



7
8
9
# File 'lib/conekta/fiscal_entity.rb', line 7

def tax_id
  @tax_id
end

Instance Method Details

#_urlObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/conekta/fiscal_entity.rb', line 10

def _url
  if (id.nil? || id.to_s.empty?)
    exception = Error.new({
                            "message" => I18n.t('error.resource.id',  { resource: self.class.class_name, locale: :en }),
                            "message_to_purchaser" => I18n.t('error.resource.id_purchaser',  { locale: Conekta.locale.to_sym })
                          })

    if Conekta.api_version == "2.0.0"
      error_list = Conekta::ErrorList.new
      error_list.details << exception
      exception = error_list
    end

    raise exception
  end

  self.send(parent)._url + "/fiscal_entities/" + id
end

#deleteObject



33
34
35
# File 'lib/conekta/fiscal_entity.rb', line 33

def delete
  self.delete_member(parent,'fiscal_entities')
end

#parentObject



29
30
31
# File 'lib/conekta/fiscal_entity.rb', line 29

def parent
  self.respond_to?(:order) ? "order" : "customer"
end