Class: Conexa::Customer
- Inherits:
-
Model
- Object
- ConexaObject
- Model
- Conexa::Customer
- Defined in:
- lib/conexa/resources/customer.rb
Overview
Customer resource for managing clients in Conexa
Constant Summary
Constants inherited from ConexaObject
Conexa::ConexaObject::RESOURCES
Instance Attribute Summary collapse
-
#company_id ⇒ Integer
readonly
Company/Unit ID.
-
#created_at ⇒ String?
readonly
Created at timestamp (W3C format).
-
#customer_id ⇒ Integer
readonly
Customer ID (also accessible as #id).
-
#has_login_access ⇒ Boolean
readonly
Whether customer has login access.
-
#is_active ⇒ Boolean
readonly
Whether customer is active.
-
#is_blocked ⇒ Boolean
readonly
Whether customer is blocked.
-
#is_foreign ⇒ Boolean
readonly
Whether customer is a foreigner.
-
#is_juridical_person ⇒ Boolean
readonly
Whether customer is a legal person (PJ).
-
#legal_person ⇒ Hash?
readonly
Legal person data (cnpj, foundation_date, etc.).
-
#name ⇒ String
readonly
Customer name.
-
#natural_person ⇒ Hash?
readonly
Natural person data (cpf, birth_date, etc.).
-
#trade_name ⇒ String?
readonly
Trade name.
Attributes inherited from ConexaObject
Class Method Summary collapse
-
.charges(customer_id) ⇒ Result
List charges for a customer without fetching the customer first.
-
.contracts(customer_id) ⇒ Result
List contracts for a customer without fetching the customer first.
-
.persons(customer_id) ⇒ Result
List persons (requesters) for a customer without fetching the customer first.
Instance Method Summary collapse
-
#address ⇒ Address?
Customer address.
-
#charges ⇒ Result
List charges for this customer.
-
#contracts ⇒ Result
List contracts for this customer.
-
#emails_financial_messages ⇒ Array<String>
Financial emails (empty array if null).
-
#emails_message ⇒ Array<String>
Message emails (empty array if null).
-
#persons ⇒ Result
List persons (requesters) for this customer.
-
#phones ⇒ Array<String>
Phone numbers (empty array if null).
-
#tags_id ⇒ Array<Integer>
Tag IDs (empty array if null).
Methods inherited from Model
all, #class_name, class_name, #create, create, #destroy, destroy, extract_page_size_or_params, #fetch, find_by, find_by_id, #id, #primary_key, primary_key_attribute, #primary_key_name, #save, #set_primary_key, show_url, underscored_class_name, url
Methods inherited from ConexaObject
#==, #[]=, convert, #empty?, #initialize, #respond_to_missing?, #to_hash, #unsaved_attributes
Constructor Details
This class inherits a constructor from Conexa::ConexaObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Conexa::ConexaObject
Instance Attribute Details
#company_id ⇒ Integer (readonly)
Returns Company/Unit ID.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#created_at ⇒ String? (readonly)
Returns Created at timestamp (W3C format).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#customer_id ⇒ Integer (readonly)
Returns Customer ID (also accessible as #id).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#has_login_access ⇒ Boolean (readonly)
Returns Whether customer has login access.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#is_active ⇒ Boolean (readonly)
Returns Whether customer is active.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#is_blocked ⇒ Boolean (readonly)
Returns Whether customer is blocked.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#is_foreign ⇒ Boolean (readonly)
Returns Whether customer is a foreigner.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#is_juridical_person ⇒ Boolean (readonly)
Returns Whether customer is a legal person (PJ).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#legal_person ⇒ Hash? (readonly)
Returns Legal person data (cnpj, foundation_date, etc.).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#name ⇒ String (readonly)
Returns Customer name.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#natural_person ⇒ Hash? (readonly)
Returns Natural person data (cpf, birth_date, etc.).
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
#trade_name ⇒ String? (readonly)
Returns Trade name.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/conexa/resources/customer.rb', line 45 class Customer < Model primary_key_attribute :customer_id # @return [Array<String>] Phone numbers (empty array if null) def phones @attributes['phones'] || [] end # @return [Array<String>] Message emails (empty array if null) def @attributes['emails_message'] || [] end # @return [Array<String>] Financial emails (empty array if null) def @attributes['emails_financial_messages'] || [] end # @return [Array<Integer>] Tag IDs (empty array if null) def @attributes['tags_id'] || [] end # @return [Address, nil] Customer address def address return nil unless @attributes['address'] Address.new(@attributes['address']) end # List persons (requesters) for this customer # @return [Result] List of persons def persons Conexa::Person.all(customer_id: id, limit: 100) end # List contracts for this customer # @return [Result] List of contracts def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end # List charges for this customer # @return [Result] List of charges def charges Conexa::Charge.all(customer_id: [id], limit: 100) end class << self # List persons (requesters) for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of persons def persons(customer_id) Conexa::Person.all(customer_id: customer_id, limit: 100) end # List contracts for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of contracts def contracts(customer_id) Conexa::Contract.all(customer_id: [customer_id], limit: 100) end # List charges for a customer without fetching the customer first # @param customer_id [Integer] Customer ID # @return [Result] List of charges def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end end end |
Class Method Details
.charges(customer_id) ⇒ Result
List charges for a customer without fetching the customer first
110 111 112 |
# File 'lib/conexa/resources/customer.rb', line 110 def charges(customer_id) Conexa::Charge.all(customer_id: [customer_id], limit: 100) end |
Instance Method Details
#address ⇒ Address?
Returns Customer address.
69 70 71 72 |
# File 'lib/conexa/resources/customer.rb', line 69 def address return nil unless @attributes['address'] Address.new(@attributes['address']) end |
#charges ⇒ Result
List charges for this customer
88 89 90 |
# File 'lib/conexa/resources/customer.rb', line 88 def charges Conexa::Charge.all(customer_id: [id], limit: 100) end |
#contracts ⇒ Result
List contracts for this customer
82 83 84 |
# File 'lib/conexa/resources/customer.rb', line 82 def contracts Conexa::Contract.all(customer_id: [id], limit: 100) end |
#emails_financial_messages ⇒ Array<String>
Returns Financial emails (empty array if null).
59 60 61 |
# File 'lib/conexa/resources/customer.rb', line 59 def @attributes['emails_financial_messages'] || [] end |
#emails_message ⇒ Array<String>
Returns Message emails (empty array if null).
54 55 56 |
# File 'lib/conexa/resources/customer.rb', line 54 def @attributes['emails_message'] || [] end |
#persons ⇒ Result
List persons (requesters) for this customer
76 77 78 |
# File 'lib/conexa/resources/customer.rb', line 76 def persons Conexa::Person.all(customer_id: id, limit: 100) end |
#phones ⇒ Array<String>
Returns Phone numbers (empty array if null).
49 50 51 |
# File 'lib/conexa/resources/customer.rb', line 49 def phones @attributes['phones'] || [] end |
#tags_id ⇒ Array<Integer>
Returns Tag IDs (empty array if null).
64 65 66 |
# File 'lib/conexa/resources/customer.rb', line 64 def @attributes['tags_id'] || [] end |