diff --git a/.gitignore b/.gitignore index 0cb6eeb..d4e690f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /pkg/ /spec/reports/ /tmp/ +.byebug_history diff --git a/README.md b/README.md index a2c64d0..854b95f 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,78 @@ params = { client.payments.create(params) ``` +### Company + +You can get the company: +```ruby +client.company.find +``` + +Also you can update it, as follows: +```ruby +params = { website: 'nominapp.com' } + +client.company.update(params) +``` + +### Users + +You can get the users: +```ruby +client.users.list +``` + +Also you can retrive a specific user by doing: +```ruby +client.users.find(1) +``` + +Lastly you can retrive the current user, as follows: +```ruby +client.users.find_current +``` + +### Categories + +You can get all the categories on the client account like this: +```ruby +client.categories.list #this will retrieve the tree format by default +``` +Or if you prefer the plain format from the Alegra API just pass it as a paramater: +```ruby +client.categories.list(format: 'plain') +``` +You can also retrive a specific category, as follows: +```ruby +client.categories.find('5047') +``` + +### BankAccounts + +To retrive all bank accounts: +```ruby +client.bank_accounts.list +``` +Or get a specific bank_account by id: +```ruby +client.bank_accounts.find(2) +``` +Also you are able to create a new bank accounts, as follows: +```ruby +params = { name: 'test', + type: 'bank', + initial_balance: '100000', + initial_balance_date: '2020-02-25' } + +client.bank_accounts.create(params) +``` +And to create a bank transfer between accounts: +```ruby +params = { id_destination: 4, # 4 is the destination bank_account_id + amount: 100000, + date: '2020-02-25' } +client.bank_accounts.transfer(7, params) # 7 is the origin bank_account_id +``` ## Development @@ -223,4 +295,4 @@ The gem is available as open source under the terms of the [MIT License](http:// ## Contributors - Diego Gomez -- Nicolas Mena \ No newline at end of file +- Nicolas Mena diff --git a/lib/alegra/bank_accounts.rb b/lib/alegra/bank_accounts.rb new file mode 100644 index 0000000..af15fd9 --- /dev/null +++ b/lib/alegra/bank_accounts.rb @@ -0,0 +1,21 @@ +module Alegra + class BankAccounts < Alegra::Record + def list(options = { format: :formated }) + client.get('bank-accounts', {}, options) + end + + def find(id, options = { format: :formated }) + client.get("bank-accounts/#{id}", {}, options) + end + + def create(params, options = { format: :formated }) + params = params.deep_camel_case_lower_keys + client.post('bank-accounts', params, options) + end + + def transfer(id, params, options = { format: :formated }) + params = params.deep_camel_case_lower_keys + client.post("bank-accounts/#{id}/transfer", params, options) + end + end +end diff --git a/lib/alegra/categories.rb b/lib/alegra/categories.rb new file mode 100644 index 0000000..dd16e81 --- /dev/null +++ b/lib/alegra/categories.rb @@ -0,0 +1,11 @@ +module Alegra + class Categories < Alegra::Record + def list(params = {}, options = { format: :formated }) + client.get('categories', params, options) + end + + def find(id, options = { format: :formated }) + client.get("categories/#{id}", {}, options) + end + end +end diff --git a/lib/alegra/client.rb b/lib/alegra/client.rb index 5cce99e..f82a7cb 100644 --- a/lib/alegra/client.rb +++ b/lib/alegra/client.rb @@ -1,9 +1,14 @@ require 'alegra/setup' require 'alegra/request' +require 'alegra/record' require 'alegra/invoices' require 'alegra/contacts' require 'alegra/items' require 'alegra/payments' +require 'alegra/company' +require 'alegra/users' +require 'alegra/categories' +require 'alegra/bank_accounts' module Alegra class Client @@ -11,24 +16,24 @@ def initialize(username=nil, apikey=nil, debug=false) @setup = Alegra::Setup.new(username, apikey, debug) end - def get(url, params = {}) + def get(url, params = {}, options = { format: :formated }) request = Alegra::Request.new(@setup.host, @setup.path, @setup.token) - request.get(url, params) + request.get(url, params, options) end - def post(url, params = {}) + def post(url, params = {}, options = { format: :formated }) request = Alegra::Request.new(@setup.host, @setup.path, @setup.token) - request.post(url, params) + request.post(url, params, options) end - def put(url, params={}) + def put(url, params={}, options = { format: :formated }) request = Alegra::Request.new(@setup.host, @setup.path, @setup.token) - request.put(url, params) + request.put(url, params, options) end - def delete(url, params={}) + def delete(url, params={}, options = { format: :formated }) request = Alegra::Request.new(@setup.host, @setup.path, @setup.token) - request.delete(url, params) + request.delete(url, params, options) end def contacts @@ -46,5 +51,21 @@ def items def payments Alegra::Payments.new(self) end + + def company + Alegra::Company.new(self) + end + + def users + Alegra::Users.new(self) + end + + def categories + Alegra::Categories.new(self) + end + + def bank_accounts + Alegra::BankAccounts.new(self) + end end end diff --git a/lib/alegra/company.rb b/lib/alegra/company.rb new file mode 100644 index 0000000..5255c7f --- /dev/null +++ b/lib/alegra/company.rb @@ -0,0 +1,12 @@ +module Alegra + class Company < Alegra::Record + def find(options = { format: :formated }) + client.get('company', {}, options) + end + + def update(params, options = { format: :formated }) + sanitize_params = params.deep_camel_case_lower_keys + client.put('company', sanitize_params, options) + end + end +end diff --git a/lib/alegra/contacts.rb b/lib/alegra/contacts.rb index c1c6b07..a6a12ea 100644 --- a/lib/alegra/contacts.rb +++ b/lib/alegra/contacts.rb @@ -1,11 +1,5 @@ module Alegra - class Contacts - attr_reader :client - - def initialize(client) - @client = client - end - + class Contacts < Alegra::Record # @param id [ Integer ] # @return [ Hash ] def find(id) @@ -80,4 +74,4 @@ def delete(id) client.delete("contacts/#{id}") end end -end \ No newline at end of file +end diff --git a/lib/alegra/invoices.rb b/lib/alegra/invoices.rb index 884bf97..bec7dbc 100644 --- a/lib/alegra/invoices.rb +++ b/lib/alegra/invoices.rb @@ -1,11 +1,5 @@ module Alegra - class Invoices - attr_reader :client - - def initialize(client) - @client = client - end - + class Invoices < Alegra::Record # @param id [ Integer ] # @return [ Hash ] def find(id) diff --git a/lib/alegra/items.rb b/lib/alegra/items.rb index b481409..625ddf5 100644 --- a/lib/alegra/items.rb +++ b/lib/alegra/items.rb @@ -1,11 +1,5 @@ module Alegra - class Items - attr_reader :client - - def initialize(client) - @client = client - end - + class Items < Alegra::Record # @param id [ Integer ] # @return [ Hash ] def find(id) @@ -53,4 +47,4 @@ def delete(id) client.delete("items/#{ id }") end end -end \ No newline at end of file +end diff --git a/lib/alegra/payments.rb b/lib/alegra/payments.rb index 7558da8..cdc7b70 100644 --- a/lib/alegra/payments.rb +++ b/lib/alegra/payments.rb @@ -1,11 +1,5 @@ module Alegra - class Payments - attr_reader :client - - def initialize(client) - @client = client - end - + class Payments < Alegra::Record # @param id [ Integer ] # @return [ Hash ] def find(id) @@ -73,4 +67,4 @@ def delete(id) client.delete("payments/#{id}") end end -end \ No newline at end of file +end diff --git a/lib/alegra/record.rb b/lib/alegra/record.rb new file mode 100644 index 0000000..627ea0a --- /dev/null +++ b/lib/alegra/record.rb @@ -0,0 +1,9 @@ +module Alegra + class Record + attr_reader :client + + def initialize(client) + @client = client + end + end +end diff --git a/lib/alegra/request.rb b/lib/alegra/request.rb index b70909e..2a35111 100644 --- a/lib/alegra/request.rb +++ b/lib/alegra/request.rb @@ -9,7 +9,7 @@ def initialize(host, path, token=nil) @session = Faraday.new url: host end - def get(url, params = {}) + def get(url, params = {}, options = { format: :formated }) params = URI.encode_www_form(params) response = @session.get do |req| @@ -18,12 +18,10 @@ def get(url, params = {}) req.headers['Accept'] = 'application/json' req.headers['Authorization'] = "Basic #{@token}" end - - cast_error(response) unless response.status == 200 || response.status == 201 - Alegra::Response.new(response.body).call + response_of_request(response, options) end - def post(url, params = {}) + def post(url, params = {}, options = { format: :formated }) params = JSON.generate(params) response = @session.post do |req| req.url "#{ @path }#{ url }" @@ -32,11 +30,10 @@ def post(url, params = {}) req.headers['Authorization'] = "Basic #{ @token }" req.body = params end - cast_error(response) unless (response.status == 200 || response.status == 201) - return Alegra::Response.new(response.body).call + response_of_request(response, options) end - def put(url, params={}) + def put(url, params={}, options = { format: :formated }) params = JSON.generate(params) response = @session.put do |req| req.url "#{ @path }#{ url }" @@ -45,12 +42,10 @@ def put(url, params={}) req.headers['Authorization'] = "Basic #{ @token }" req.body = params end - cast_error(response) unless (response.status == 200 || response.status == 201) - return Alegra::Response.new(response.body).call + response_of_request(response, options) end - - def delete(url, params={}) + def delete(url, params={}, options = { format: :formated }) params = JSON.generate(params) response = @session.delete do |req| req.url "#{ @path }#{ url }" @@ -59,12 +54,28 @@ def delete(url, params={}) req.headers['Authorization'] = "Basic #{ @token }" req.body = params end - cast_error(response) unless (response.status == 200 || response.status == 201) - return Alegra::Response.new(response.body).call + response_of_request(response, options) + end + + private + + def response_of_request(response, options = { format: :formated }) + cast_error(response, options) unless response.status == 200 || response.status == 201 + + raise_invalid_format options[:format] + + return response if options[:format] == :raw + + Alegra::Response.new(response.body).call end - def cast_error(response) + def cast_error(response, options = { format: :formated }) + raise_invalid_format options[:format] + + return response if options[:format] == :raw + message = response.body.empty? ? response.body : Alegra::Response.new(response.body).call['message'] + error_map = { 500 => 'Sever error! Something were wrong in the server.', 400 => "Bad request!, #{ message }", @@ -76,5 +87,12 @@ def cast_error(response) } raise StandardError, "Status: #{ response.status }. Error: #{ error_map[response.status] }" end + + def raise_invalid_format(format) + return if %i[formated raw].include?(format) + return if format.nil? + + raise StandardError, "#{format} is not a valid format, valid_formats[:formated, :raw]" + end end -end \ No newline at end of file +end diff --git a/lib/alegra/response.rb b/lib/alegra/response.rb index e3298f0..da28b06 100644 --- a/lib/alegra/response.rb +++ b/lib/alegra/response.rb @@ -16,4 +16,4 @@ def call(options={}) end end end -end \ No newline at end of file +end diff --git a/lib/alegra/users.rb b/lib/alegra/users.rb new file mode 100644 index 0000000..b2e8c9d --- /dev/null +++ b/lib/alegra/users.rb @@ -0,0 +1,15 @@ +module Alegra + class Users < Alegra::Record + def list(options = { format: :formated }) + client.get('users', {}, options) + end + + def find(id, options = { format: :formated }) + client.get("users/#{id}", {}, options) + end + + def find_current(options = { format: :formated }) + client.get('users/self', {}, options) + end + end +end diff --git a/spec/alegra/bank_accounts_spec.rb b/spec/alegra/bank_accounts_spec.rb new file mode 100644 index 0000000..5f7c2c4 --- /dev/null +++ b/spec/alegra/bank_accounts_spec.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Alegra::BankAccounts do + context 'BankAccounts' do + before :each do + @params = { + username: 'ejemploapi@dayrep.com', + apikey: '066b3ab09e72d4548e88' + } + @client = Alegra::Client.new(@params[:username], @params[:apikey]) + end + + it 'should list all bank accounts' do + VCR.use_cassette('bank_accounts') do + expected_response = [{ id: '2', + name: 'Banco 1', + number: nil, + description: '', + type: 'bank', + status: 'active' }, + { id: '3', + name: 'Tarjeta de crédito 1', + number: nil, + description: '', + type: 'credit-card', + status: 'active' }, + { id: '1', + name: 'Caja general', + number: nil, + description: 'Caja general de la empresa', + type: 'cash', + status: 'active' }] + + bank_accounts = @client.bank_accounts.list + expect(bank_accounts.class).to eq Array + expect(bank_accounts).to eq expected_response + end + end + + it 'should get a specific bank_account' do + VCR.use_cassette('simple_bank_account') do + expected_response = { id: '2', + name: 'Banco 1', + number: nil, + description: '', + type: 'bank', + status: 'active' } + bank_account = @client.bank_accounts.find(2) + expect(bank_account.class).to eq Hash + expect(bank_account).to eq(expected_response) + end + end + + it 'creates a new bank_account' do + VCR.use_cassette('create_simple_bank_account') do + expected_response = { id: '9', + name: 'test', + number: nil, + description: '', + type: 'bank', + status: 'active' } + + params = { name: 'test', + type: 'bank', + initial_balance: '100000', + initial_balance_date: '2020-02-25' } + + bank_account = @client.bank_accounts.create(params) + expect(bank_account.class).to eq Hash + expect(bank_account).to eq(expected_response) + end + end + + it 'creates a new transfer from bank_account :id to an other' do + VCR.use_cassette('create_simple_bank_transfer') do + expected_response = { origin_account: { id: '7', + name: 'test', + number: nil, + description: '', + type: 'bank', + status: 'active' }, + destination_account: { id: '4', + name: 'Bancolombia', + number: '0093230987', + description: 'Cuenta de Bancolombia', + type: 'bank', + status: 'active' }, + amount: 100_000 } + + params = { id_destination: 4, + amount: 100000, + date: '2020-02-25' } + + bank_account_transfer = @client.bank_accounts.transfer(7, params) + expect(bank_account_transfer.class).to eq Hash + expect(bank_account_transfer).to eq(expected_response) + end + end + end +end diff --git a/spec/alegra/categories_spec.rb b/spec/alegra/categories_spec.rb new file mode 100644 index 0000000..1be243a --- /dev/null +++ b/spec/alegra/categories_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Alegra::Categories do + context 'Categories' do + before :each do + @params = { + username: 'ejemploapi@dayrep.com', + apikey: '066b3ab09e72d4548e88' + } + @client = Alegra::Client.new(@params[:username], @params[:apikey]) + end + + it 'should list all categories' do + VCR.use_cassette('categories') do + categories = @client.categories.list(format: 'plain') + expect(categories.class).to eq Array + expect(categories.size).to eq 91 + end + end + + it 'should get a specific category' do + VCR.use_cassette('simple_category') do + expected_response = { id: '5047', + id_parent: '5046', + name: 'Cuentas por pagar - proveedores', + description: 'Bajo esta categoría se encuentran los pasivos principales', + type: 'liability', + read_only: false, + category_rule: {id: '11', name: 'Cuentas por pagar - proveedores', key: 'DEBTS_TO_PAY_PROVIDERS'} } + category = @client.categories.find('5047') + expect(category.class).to eq Hash + expect(category).to eq(expected_response) + end + end + end +end diff --git a/spec/alegra/company_spec.rb b/spec/alegra/company_spec.rb new file mode 100644 index 0000000..74edd71 --- /dev/null +++ b/spec/alegra/company_spec.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Alegra::Company do + context 'Company' do + before :each do + @params = { + username: 'ejemploapi@dayrep.com', + apikey: '066b3ab09e72d4548e88' + } + @client = Alegra::Client.new(@params[:username], @params[:apikey]) + end + + it 'should get the company information' do + VCR.use_cassette('company') do + expected_response = { + name: 'ejemploapi@legra', + identification: '1061687132-1', + phone: '5167770', + website: 'test.com', + email: 'test@test.com', + regime: 'Responsable del IVA', + application_version: 'colombia', + registry_date: '2016-10-12 09:48:45', + timezone: 'America/Bogota', + profile: nil, + address: { city: 'Medellin', department: nil, address: 'calle falsa 123', zip_code: nil }, + currency: { code: 'COP', symbol: '$' }, + multicurrency: false, + decimal_precision: '0', + invoice_preferences: { default_anotation: nil, + default_terms_and_conditions: 'Esta factura se asimila en todos sus efectos a una letra de cambio de conformidad con el Art. 774 del código de comercio. Autorizo que en caso de incumplimiento de esta obligación sea reportado a las centrales de riesgo, se cobraran intereses por mora.' }, + logo: 'https://d3r8o2i8390sjv.cloudfront.net/application/production/company-logos/48302296106c20092d3279f24', + kind_of_person: '', + identification_object: { type: nil, number: '1061687132-1' }, + settings: { can_stamp_invoices: false, electronic_invoicing: false } + } + + company = @client.company.find + expect(company.class).to eq Hash + expect(company).to eq expected_response + end + end + + it 'should update the company' do + VCR.use_cassette('update_completed_company') do + expected_response = { + name: 'ejemploapi@legra', + identification: '1061687132-1', + phone: '5167770', + website: 'nominapp.com', + email: 'test@test.com', + regime: 'Responsable del IVA', + application_version: 'colombia', + registry_date: '2016-10-12 09:48:45', + timezone: 'America/Bogota', + profile: nil, + address: { city: 'Medellin', department: nil, address: 'calle falsa 123', zip_code: nil }, + currency: { code: 'COP', symbol: '$' }, + multicurrency: false, + decimal_precision: '0', + invoice_preferences: { default_anotation: nil, + default_terms_and_conditions: 'Esta factura se asimila en todos sus efectos a una letra de cambio de conformidad con el Art. 774 del código de comercio. Autorizo que en caso de incumplimiento de esta obligación sea reportado a las centrales de riesgo, se cobraran intereses por mora.' }, + logo: 'https://d3r8o2i8390sjv.cloudfront.net/application/production/company-logos/48302296106c20092d3279f24', + kind_of_person: '', + identification_object: { type: nil, number: '1061687132-1' }, + settings: { can_stamp_invoices: false, electronic_invoicing: false } + } + params = { website: 'nominapp.com' } + company = @client.company.update(params) + expect(company.class).to eq Hash + expect(company).to eq(expected_response) + end + end + end +end diff --git a/spec/alegra/users_spec.rb b/spec/alegra/users_spec.rb new file mode 100644 index 0000000..a57336a --- /dev/null +++ b/spec/alegra/users_spec.rb @@ -0,0 +1,215 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Alegra::Users do + context 'User' do + before :each do + @params = { + username: 'ejemploapi@dayrep.com', + apikey: '066b3ab09e72d4548e88' + } + @client = Alegra::Client.new(@params[:username], @params[:apikey]) + end + + it 'should get the lists of users' do + VCR.use_cassette('users') do + expected_response = [ + { + email: 'ejemploapi@dayrep.com', + id: '1', + last_name: nil, + name: nil, + permissions: { + bank_accounts: { add: 'allow', transfer: 'allow', view: 'allow' }, + bills: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + categories: { view: 'allow' }, + company: { edit: 'allow', retrieve_info: 'allow' }, + contacts: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + currencies: { index: 'allow' }, + estimates: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + invoices: { + add: 'allow', + edit: 'allow', + edit_items_prices: 'allow', + email: 'allow', + view: 'allow', + void: 'allow' + }, + items: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + payments: { + add: 'allow', + edit: 'allow', + edit_in: 'allow', + edit_out: 'allow', + retrieve_in: 'allow', + view: 'allow', + viewin: 'allow', + viewout: 'allow' + }, + pos_cashier: { + close: 'allow', index: 'allow', open: 'allow', view: 'allow' + }, + pos_station: { + add: 'allow', + delete: 'allow', + edit: 'allow', + index: 'allow', + view: 'allow' + }, + price_lists: { view: 'allow' }, + remissions: { + add: 'allow', + delete: 'allow', + edit: 'allow', + view: 'allow' + }, + retentions: { view: 'allow' }, + sellers: { add: 'allow', edit: 'allow' }, + taxes: { view: 'allow' }, + terms: { view: 'allow' } + }, + role: 'admin', + status: 'active' + } + ] + users = @client.users.list + expect(users.class).to eq Array + expect(users).to eq expected_response + end + end + + it 'should return user with specific :id' do + VCR.use_cassette('simple_user') do + expected_response = { email: 'ejemploapi@dayrep.com', + id: '1', + last_name: nil, + name: nil, + permissions: { + bank_accounts: { add: 'allow', transfer: 'allow', view: 'allow' }, + bills: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + categories: { view: 'allow' }, + company: { edit: 'allow', retrieve_info: 'allow' }, + contacts: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + currencies: { index: 'allow' }, + estimates: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + invoices: { + add: 'allow', + edit: 'allow', + edit_items_prices: 'allow', + email: 'allow', + view: 'allow', + void: 'allow' + }, + items: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + payments: { + add: 'allow', + edit: 'allow', + edit_in: 'allow', + edit_out: 'allow', + retrieve_in: 'allow', + view: 'allow', + viewin: 'allow', + viewout: 'allow' + }, + pos_cashier: { + close: 'allow', index: 'allow', open: 'allow', view: 'allow' + }, + pos_station: { + add: 'allow', + delete: 'allow', + edit: 'allow', + index: 'allow', + view: 'allow' + }, + price_lists: { view: 'allow' }, + remissions: { + add: 'allow', + delete: 'allow', + edit: 'allow', + view: 'allow' + }, + retentions: { view: 'allow' }, + sellers: { add: 'allow', edit: 'allow' }, + taxes: { view: 'allow' }, + terms: { view: 'allow' } + }, + role: 'admin', + status: 'active' } + users = @client.users.find(1) + expect(users.class).to eq Hash + expect(users).to eq expected_response + end + end + + it 'should return current user' do + VCR.use_cassette('self_user') do + expected_response = { email: 'ejemploapi@dayrep.com', + id: '1', + last_name: nil, + name: nil, + permissions: { + bank_accounts: { add: 'allow', transfer: 'allow', view: 'allow' }, + bills: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + categories: { view: 'allow' }, + company: { edit: 'allow', retrieve_info: 'allow' }, + contacts: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + currencies: { index: 'allow' }, + estimates: + { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + invoices: { + add: 'allow', + edit: 'allow', + edit_items_prices: 'allow', + email: 'allow', + view: 'allow', + void: 'allow' + }, + items: { add: 'allow', delete: 'allow', edit: 'allow', view: 'allow' }, + payments: { + add: 'allow', + edit: 'allow', + edit_in: 'allow', + edit_out: 'allow', + retrieve_in: 'allow', + view: 'allow', + viewin: 'allow', + viewout: 'allow' + }, + pos_cashier: { + close: 'allow', index: 'allow', open: 'allow', view: 'allow' + }, + pos_station: { + add: 'allow', + delete: 'allow', + edit: 'allow', + index: 'allow', + view: 'allow' + }, + price_lists: { view: 'allow' }, + remissions: { + add: 'allow', + delete: 'allow', + edit: 'allow', + view: 'allow' + }, + retentions: { view: 'allow' }, + sellers: { add: 'allow', edit: 'allow' }, + taxes: { view: 'allow' }, + terms: { view: 'allow' } + }, + role: 'admin', + status: 'active' } + user = @client.users.find_current + expect(user.class).to eq Hash + expect(user).to eq expected_response + expect(user[:email]).to eq @params[:username] + end + end + end +end diff --git a/spec/fixtures/cassettes/bank_accounts.yml b/spec/fixtures/cassettes/bank_accounts.yml new file mode 100644 index 0000000..f31d182 --- /dev/null +++ b/spec/fixtures/cassettes/bank_accounts.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/bank-accounts + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 26 Feb 2020 00:51:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=8tae2huqaei8kke5vv29idrjt7; expires=Fri, 25-Feb-2022 00:51:02 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '[{"id":"2","name":"Banco 1","number":null,"description":"","type":"bank","status":"active"},{"id":"3","name":"Tarjeta + de cr\u00e9dito 1","number":null,"description":"","type":"credit-card","status":"active"},{"id":"1","name":"Caja + general","number":null,"description":"Caja general de la empresa","type":"cash","status":"active"}]' + http_version: null + recorded_at: Wed, 26 Feb 2020 00:51:02 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/categories.yml b/spec/fixtures/cassettes/categories.yml new file mode 100644 index 0000000..783a29f --- /dev/null +++ b/spec/fixtures/cassettes/categories.yml @@ -0,0 +1,211 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/categories?format=plain + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 26 Feb 2020 00:21:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=1d5lgob60j79tvdsfa23me8ai6; expires=Fri, 25-Feb-2022 00:21:12 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '[{"id":"5001","idParent":"5026","name":"Inversiones","description":"","type":"asset","readOnly":false,"categoryRule":null},{"id":"5002","idParent":"5026","name":"Pr\u00e9stamos + a terceros","description":"","type":"asset","readOnly":false,"categoryRule":null},{"id":"5003","idParent":"5073","name":"Alquiler + de equipos y licencias","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5004","idParent":"5073","name":"Comisiones + y honorarios","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5005","idParent":"5073","name":"Transporte + y mensajer\u00eda","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5006","idParent":"5073","name":"Legales","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5007","idParent":"5073","name":"N\u00f3mina","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5008","idParent":"5007","name":"Prestaciones + sociales","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5009","idParent":"5007","name":"Salarios","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5010","idParent":"5007","name":"Seguridad + social y parafiscales","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5011","idParent":"5007","name":"Dotaci\u00f3n","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5012","idParent":"5073","name":"Publicidad","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5013","idParent":"5073","name":"Seguros + y seguridad","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5014","idParent":"5073","name":"Servicios + bancarios","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5015","idParent":"5073","name":"Suscripciones + y afiliaciones","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5016","idParent":"5073","name":"Varios","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5017","idParent":"5073","name":"Mantenimiento + e instalaciones","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5018","idParent":"5073","name":"Viajes + y vi\u00e1ticos","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5019","idParent":"5074","name":"Flete + y env\u00edos","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5020","idParent":"5074","name":"Mano + de obra","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5021","idParent":"5081","name":"Arrendamiento","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5022","idParent":"5081","name":"Internet + y telecomunicaciones","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5023","idParent":"5081","name":"Aseo + y cafeter\u00eda","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5024","idParent":"5081","name":"Papeler\u00eda","description":"","type":"expense","readOnly":false,"categoryRule":null},{"id":"5025","idParent":"5062","name":"Capital + accionistas","description":"","type":"equity","readOnly":false,"categoryRule":null},{"id":"5026","idParent":null,"name":"Activos","description":"Bajo + esta categor\u00eda se encuentran los activos que tiene la empresa","type":"asset","readOnly":false,"categoryRule":{"id":"1","name":"Activos","key":"ASSETS"}},{"id":"5027","idParent":"5026","name":"Activos + fijos","description":"Bajo esta categor\u00eda se ubican los activos principales + de la empresa","type":"asset","readOnly":false,"categoryRule":{"id":"2","name":"Activos + fijos","key":"FIXED_ASSET"}},{"id":"5028","idParent":"5026","name":"Retenciones + a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"3","name":"Retenciones + a favor","key":"RETENTIONS_IN_FAVOR"}},{"id":"5029","idParent":"5028","name":"Retenci\u00f3n + en la fuente a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"41","name":"Retenci\u00f3n + en la fuente a favor","key":"FUENTE_RETENTION_IN_FAVOR_COL"}},{"id":"5030","idParent":"5028","name":"Retenci\u00f3n + de Industria y Comercio a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"42","name":"Retenci\u00f3n + de Industria y Comercio a favor","key":"INDUSTRY_RETENTION_IN_FAVOR_COL"}},{"id":"5031","idParent":"5028","name":"Retenci\u00f3n + de IVA a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"43","name":"Retenci\u00f3n + de IVA a favor","key":"IVA_RETENTION_IN_FAVOR_COL"}},{"id":"5032","idParent":"5028","name":"Retenci\u00f3n + de CREE a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"45","name":"Retenci\u00f3n + de CREE a favor","key":"CREE_RETENTION_IN_FAVOR_COL"}},{"id":"5033","idParent":"5028","name":"Otro + tipo de retenci\u00f3n a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"108","name":"Otro + tipo de retenci\u00f3n a favor","key":"OTHER_RETENTION_TYPE_IN_FAVOR"}},{"id":"5034","idParent":"5026","name":"Impuestos + a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"4","name":"Impuestos + a favor","key":"TAXES_IN_FAVOR"}},{"id":"5035","idParent":"5034","name":"IVA + a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"44","name":"IVA + a favor","key":"IVA_IN_FAVOR_COL"}},{"id":"5036","idParent":"5034","name":"ICO + a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"46","name":"ICO + a favor","key":"ICO_IN_FAVOR_COL"}},{"id":"5037","idParent":"5034","name":"Otro + tipo de impuesto a favor","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"106","name":"Otro + tipo de impuesto a favor","key":"OTHER_TAX_TYPE_IN_FAVOR"}},{"id":"5038","idParent":"5026","name":"Activo + corriente","description":null,"type":"asset","readOnly":false,"categoryRule":null},{"id":"5039","idParent":"5038","name":"Cuentas + por cobrar","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"5","name":"Cuentas + por cobrar","key":"RECEIVABLE_ACCOUNTS"}},{"id":"5040","idParent":"5038","name":"Bancos","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"6","name":"Bancos","key":"BANKS"}},{"id":"5041","idParent":"5040","name":"Cuentas + bancarias","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"85","name":"Bancos + tipo banco","key":"BANK_ACCOUNTS"}},{"id":"5042","idParent":"5040","name":"Efectivo","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"86","name":"Bancos + tipo efectivo","key":"CASH_ACCOUNTS"}},{"id":"5043","idParent":"5038","name":"Inventario","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"7","name":"Inventario","key":"INVENTORY"}},{"id":"5044","idParent":"5026","name":"Cuentas + por cobrar - devoluciones","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"8","name":"Cuentas + por cobrar - devoluciones","key":"RECEIVABLE_ACCOUNTS_RETURNS"}},{"id":"5045","idParent":"5026","name":"Avances + y anticipos entregados","description":null,"type":"asset","readOnly":false,"categoryRule":{"id":"9","name":"Avances + y anticipos entregados","key":"ADVANCE_OUT"}},{"id":"5046","idParent":null,"name":"Pasivos","description":"Bajo + esta categor\u00eda se encuentran los pasivos de la empresa","type":"liability","readOnly":false,"categoryRule":{"id":"10","name":"Pasivos","key":"LIABILITIES"}},{"id":"5047","idParent":"5046","name":"Cuentas + por pagar - proveedores","description":"Bajo esta categor\u00eda se encuentran + los pasivos principales","type":"liability","readOnly":false,"categoryRule":{"id":"11","name":"Cuentas + por pagar - proveedores","key":"DEBTS_TO_PAY_PROVIDERS"}},{"id":"5048","idParent":"5046","name":"Obligaciones + financieras y pr\u00e9stamos a terceros","description":null,"type":"liability","readOnly":false,"categoryRule":null},{"id":"5049","idParent":"5046","name":"Retenciones + por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"12","name":"Retenciones + por pagar","key":"RETENTIONS_TO_PAY"}},{"id":"5050","idParent":"5049","name":"Retenci\u00f3n + en la fuente por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"48","name":"Retenci\u00f3n + en la fuente por pagar","key":"FUENTE_RETENTION_TO_PAY_COL"}},{"id":"5051","idParent":"5049","name":"Retenci\u00f3n + de Industria y Comercio por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"49","name":"Retenci\u00f3n + de Industria y Comercio por pagar","key":"INDUSTRY_RETENTION_TO_PAY_COL"}},{"id":"5052","idParent":"5049","name":"Retenci\u00f3n + de IVA por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"50","name":"Retenci\u00f3n + de IVA por pagar","key":"IVA_RETENTION_TO_PAY_COL"}},{"id":"5053","idParent":"5049","name":"Retenci\u00f3n + de CREE por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"52","name":"Retenci\u00f3n + de CREE por pagar","key":"CREE_RETENTION_TO_PAY_COL"}},{"id":"5054","idParent":"5049","name":"Otro + tipo de retenci\u00f3n por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"107","name":"Otro + tipo de retenci\u00f3n por pagar","key":"OTHER_RETENTION_TYPE_TO_PAY"}},{"id":"5055","idParent":"5046","name":"Impuestos + por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"13","name":"Impuestos + por pagar","key":"TAXES_TO_PAY"}},{"id":"5056","idParent":"5055","name":"Iva + por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"47","name":"IVA + por pagar","key":"IVA_TO_PAY_COL"}},{"id":"5057","idParent":"5055","name":"ICO + por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"51","name":"ICO + por pagar","key":"ICO_TO_PAY_COL"}},{"id":"5058","idParent":"5055","name":"Otro + tipo de impuesto por pagar","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"105","name":"Otro + tipo de impuesto por pagar","key":"OTHER_TAX_TYPE_TO_PAY"}},{"id":"5059","idParent":"5046","name":"Cuentas + por pagar - tarjetas de cr\u00e9dito","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"14","name":"Cuentas + por pagar - tarjetas de cr\u00e9dito","key":"DEBTS_TO_PAY_CREDIT_CARDS"}},{"id":"5060","idParent":"5046","name":"Cuentas + por pagar - devoluciones","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"15","name":"Cuentas + por pagar - devoluciones","key":"DEBTS_TO_PAY_RETURNS"}},{"id":"5061","idParent":"5046","name":"Avances + y anticipos recibidos","description":null,"type":"liability","readOnly":false,"categoryRule":{"id":"16","name":"Avances + y anticipos recibidos","key":"ADVANCE_IN"}},{"id":"5062","idParent":null,"name":"Patrimonio","description":"Bajo + esta categor\u00eda se encuentra el patrimonio de la empresa","type":"equity","readOnly":false,"categoryRule":{"id":"17","name":"Patrimonio","key":"EQUITY"}},{"id":"5063","idParent":"5062","name":"Utilidades","description":"Bajo + esta categor\u00eda se encuentra el patrimonio principal","type":"equity","readOnly":false,"categoryRule":{"id":"18","name":"Utilidades","key":"UTILITIES"}},{"id":"5064","idParent":"5062","name":"Ajustes + iniciales - Bancos","description":null,"type":"equity","readOnly":false,"categoryRule":{"id":"19","name":"Ajustes + iniciales - Bancos","key":"INITIAL_ADJUSTMENTS_BANKS"}},{"id":"5065","idParent":"5062","name":"Ajustes + iniciales - Inventario","description":null,"type":"equity","readOnly":false,"categoryRule":{"id":"20","name":"Ajustes + iniciales - Inventario","key":"INITIAL_ADJUSTMENTS_INVENTORY"}},{"id":"5066","idParent":null,"name":"Ingresos","description":"Bajo + esta categor\u00eda se encuentran todos los tipos de ingresos.","type":"income","readOnly":false,"categoryRule":{"id":"21","name":"Ingresos","key":"INCOME"}},{"id":"5067","idParent":"5066","name":"Ventas","description":"Bajo + Esta categor\u00eda se encuentran todos los ingresos principales.","type":"income","readOnly":false,"categoryRule":{"id":"22","name":"Ventas","key":"SALES"}},{"id":"5068","idParent":"5066","name":"Ingresos + no operacionales","description":null,"type":"income","readOnly":false,"categoryRule":{"id":"25","name":"Ingresos + no operacionales","key":"NO_OPERATIONAL_INCOME"}},{"id":"5069","idParent":"5068","name":"Otros + ingresos","description":"Bajo esta categor\u00eda se encuentran otros tipos + de ingresos diferentes a los principales.","type":"income","readOnly":false,"categoryRule":{"id":"23","name":"Otros + ingresos","key":"OTHER_EARNINGS"}},{"id":"5070","idParent":"5069","name":"Ingresos + por Inter\u00e9s","description":"Ingresos por intereses bancarios","type":"income","readOnly":false,"categoryRule":{"id":"24","name":"Ingresos + por inter\u00e9s","key":"INTEREST_INCOME"}},{"id":"5071","idParent":"5066","name":"Devoluciones + en ventas","description":null,"type":"income","readOnly":false,"categoryRule":{"id":"26","name":"Devoluciones + en ventas","key":"SALES_RETURNS"}},{"id":"5072","idParent":"5066","name":"Ingreso + sin identificar","description":null,"type":"income","readOnly":false,"categoryRule":null},{"id":"5073","idParent":null,"name":"Egresos","description":"Bajo + esta categor\u00eda se encuentran todos los tipos de egresos.","type":"expense","readOnly":false,"categoryRule":{"id":"27","name":"Egresos","key":"EXPENSES"}},{"id":"5074","idParent":"5073","name":"Costo + de la mercanc\u00eda vendida","description":"En esta caetegor\u00eda se guarda + el costo de la mercanc\u00eda vendida","type":"expense","readOnly":false,"categoryRule":{"id":"29","name":"Costo + de la mercanc\u00eda vendida","key":"COST_OF_MERCHANDISE_SOLD"}},{"id":"5075","idParent":"5074","name":"Materias + primas","description":null,"type":"expense","readOnly":false,"categoryRule":null},{"id":"5076","idParent":"5074","name":"Compras + inventariables","description":null,"type":"expense","readOnly":true,"categoryRule":{"id":"33","name":"Compras + inventariables","key":"INVENTARIABLE_PURCHASES"}},{"id":"5077","idParent":"5074","name":"Ajustes + al inventario","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"36","name":"Ajustes + al inventario","key":"INVENTORY_ADJUSTMENTS"}},{"id":"5078","idParent":"5073","name":"Gastos + bancarios","description":"Bajo esta categor\u00eda se encuentran los gastos + bancarios de la compa\u00f1\u00eda","type":"expense","readOnly":false,"categoryRule":{"id":"28","name":"Gastos + bancarios","key":"BANK_EXPENSES"}},{"id":"5079","idParent":"5073","name":"Cuentas + incobrables","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"30","name":"Cuentas + incobrables","key":"UNCOLLECTIBLE_ACCOUNTS"}},{"id":"5080","idParent":"5073","name":"Otros + impuestos","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"31","name":"Otros + impuestos","key":"OTHER_TAXES"}},{"id":"5081","idParent":"5073","name":"Gastos + administrativos","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"32","name":"Gastos + administrativos","key":"ADMIN_EXPENSES"}},{"id":"5082","idParent":"5081","name":"Servicios + p\u00fablicos","description":null,"type":"expense","readOnly":false,"categoryRule":null},{"id":"5083","idParent":"5073","name":"Costo + servicios vendidos","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"34","name":"Costo + servicios vendidos","key":"SOLD_SERVICES_COST"}},{"id":"5084","idParent":"5073","name":"Egresos + no operacionales","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"35","name":"Egresos + no operacionales","key":"NO_OPERATIONAL_EXPENSES"}},{"id":"5085","idParent":"5084","name":"Diferencia + en cambio","description":"Bajo esta categor\u00eda se encuentran las p\u00e9rdidas + y ganancias por diferencias en tasas de cambio","type":"expense","readOnly":false,"categoryRule":{"id":"38","name":"Diferencia + en cambio","key":"EXCHANGE_DIFFERENCE"}},{"id":"5086","idParent":"5084","name":"Descuento + financiero","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"39","name":"Descuento + financiero","key":"FINANCIAL_DISCOUNT"}},{"id":"5087","idParent":"5084","name":"Ajustes + por aproximaciones en c\u00e1lculos","description":null,"type":"expense","readOnly":false,"categoryRule":{"id":"101","name":"Ajustes + por aproximaciones en c\u00e1lculos","key":"CALCULATIONS_APPROX"}},{"id":"5088","idParent":"5073","name":"Devoluciones + en compras de \u00edtem","description":null,"type":"expense","readOnly":true,"categoryRule":{"id":"37","name":"Devoluciones + en compras de \u00edtem","key":"ITEM_PURCHASES_RETURNS"}},{"id":"5089","idParent":null,"name":"Transferencias + bancarias","description":"Bajo esta categor\u00eda se ubican todas las transferencias + que se hagan entre bancos de la empresa","type":"other","readOnly":true,"categoryRule":{"id":"40","name":"Transferencias + bancarias","key":"BANK_TRANSFERS"}},{"id":"5090","idParent":"5026","name":"Propiedad, + planta y equipo (Impuestos descontables)","description":"Bajo esta categor\u00eda + se registran los activos de la empresa en los que el impuesto se toma como + descontable","type":"asset","readOnly":false,"categoryRule":{"id":"109","name":"Activos + fijos descontables","key":"FIXED_ASSET_DEDUCTIBLE"}},{"id":"5091","idParent":"5073","name":"Gastos + por impuestos no acreditables","description":"Bajo esta cuenta se registran + los movimientos de impuestos configurados como no acreditables","type":"expense","readOnly":false,"categoryRule":{"id":"114","name":"Gastos + por impuestos no acreditables","key":"TAX_NOT_DEDUCTIBLE"}}]' + http_version: null + recorded_at: Wed, 26 Feb 2020 00:21:12 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/company.yml b/spec/fixtures/cassettes/company.yml new file mode 100644 index 0000000..42f0a54 --- /dev/null +++ b/spec/fixtures/cassettes/company.yml @@ -0,0 +1,69 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/company + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 25 Feb 2020 15:19:35 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Vary: + - Accept + Cache-Control: + - no-cache + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - GET + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"name":"ejemploapi@legra","identification":"1061687132-1","phone":"5167770","website":"test.com","email":"test@test.com","regime":"Responsable + del IVA","applicationVersion":"colombia","registryDate":"2016-10-12 09:48:45","timezone":"America\/Bogota","profile":null,"address":{"city":"Medellin","department":null,"address":"calle + falsa 123","zipCode":null},"currency":{"code":"COP","symbol":"$"},"multicurrency":false,"decimalPrecision":"0","invoicePreferences":{"defaultAnotation":null,"defaultTermsAndConditions":"Esta + factura se asimila en todos sus efectos a una letra de cambio de conformidad + con el Art. 774 del c\u00f3digo de comercio. Autorizo que en caso de incumplimiento + de esta obligaci\u00f3n sea reportado a las centrales de riesgo, se cobraran + intereses por mora."},"logo":"https:\/\/d3r8o2i8390sjv.cloudfront.net\/application\/production\/company-logos\/48302296106c20092d3279f24","kindOfPerson":"","identificationObject":{"type":null,"number":"1061687132-1"},"settings":{"canStampInvoices":false,"electronicInvoicing":false}}' + http_version: null + recorded_at: Tue, 25 Feb 2020 15:19:35 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/create_simple_bank_account.yml b/spec/fixtures/cassettes/create_simple_bank_account.yml new file mode 100644 index 0000000..6d9388b --- /dev/null +++ b/spec/fixtures/cassettes/create_simple_bank_account.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: post + uri: https://app.alegra.com/api/v1/bank-accounts + body: + encoding: UTF-8 + string: '{"name":"test","type":"bank","initialBalance":"100000","initialBalanceDate":"2020-02-25"}' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic aW5mb0BxdWluY2VuYS5tZTo2ZTZhOGVkODhkOGNhMmIyN2MyMg== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Wed, 26 Feb 2020 01:06:41 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=0mlf5lbjrbectkr211s8cdah20; expires=Fri, 25-Feb-2022 01:06:41 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - '11' + X-Rate-Limit-Remaining: + - '148' + body: + encoding: UTF-8 + string: '{"id":"9","name":"test","number":null,"description":"","type":"bank","status":"active"}' + http_version: null + recorded_at: Wed, 26 Feb 2020 01:06:41 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/create_simple_bank_transfer.yml b/spec/fixtures/cassettes/create_simple_bank_transfer.yml new file mode 100644 index 0000000..8f560d7 --- /dev/null +++ b/spec/fixtures/cassettes/create_simple_bank_transfer.yml @@ -0,0 +1,71 @@ +--- +http_interactions: +- request: + method: post + uri: https://app.alegra.com/api/v1/bank-accounts/7/transfer + body: + encoding: UTF-8 + string: '{"idDestination":4,"amount":100000,"date":"2020-02-25"}' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic aW5mb0BxdWluY2VuYS5tZTo2ZTZhOGVkODhkOGNhMmIyN2MyMg== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 26 Feb 2020 01:05:54 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=k2dsra7u0vedv6vuh3nrsdfe35; expires=Fri, 25-Feb-2022 01:05:52 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"originAccount":{"id":"7","name":"test","number":null,"description":"","type":"bank","status":"active"},"destinationAccount":{"id":"4","name":"Bancolombia","number":"0093230987","description":"Cuenta + de Bancolombia","type":"bank","status":"active"},"amount":100000}' + http_version: null + recorded_at: Wed, 26 Feb 2020 01:05:54 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/self_user.yml b/spec/fixtures/cassettes/self_user.yml new file mode 100644 index 0000000..5308342 --- /dev/null +++ b/spec/fixtures/cassettes/self_user.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/users/self + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 25 Feb 2020 23:58:11 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=0g6mn6a2ao2jasnabsilif3a42; expires=Thu, 24-Feb-2022 23:58:11 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"name":null,"lastName":null,"email":"ejemploapi@dayrep.com","role":"admin","status":"active","id":"1","permissions":{"bank-accounts":{"add":"allow","transfer":"allow","view":"allow"},"bills":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"categories":{"view":"allow"},"contacts":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"company":{"edit":"allow","retrieve-info":"allow"},"invoices":{"add":"allow","edit":"allow","email":"allow","view":"allow","void":"allow","edit-items-prices":"allow"},"items":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"retentions":{"view":"allow"},"taxes":{"view":"allow"},"terms":{"view":"allow"},"payments":{"add":"allow","edit":"allow","view":"allow","edit-in":"allow","edit-out":"allow","retrieve-in":"allow","viewin":"allow","viewout":"allow"},"price-lists":{"view":"allow"},"remissions":{"add":"allow","edit":"allow","delete":"allow","view":"allow"},"estimates":{"add":"allow","delete":"allow","view":"allow","edit":"allow"},"currencies":{"index":"allow"},"sellers":{"add":"allow","edit":"allow"},"pos-cashier":{"close":"allow","index":"allow","open":"allow","view":"allow"},"pos-station":{"add":"allow","edit":"allow","view":"allow","index":"allow","delete":"allow"}}}' + http_version: null + recorded_at: Tue, 25 Feb 2020 23:58:11 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/simple_bank_account.yml b/spec/fixtures/cassettes/simple_bank_account.yml new file mode 100644 index 0000000..65ef838 --- /dev/null +++ b/spec/fixtures/cassettes/simple_bank_account.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/bank-accounts/2 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 26 Feb 2020 00:51:03 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=cn1fmmb9d5ccpc1rtkp9p2b207; expires=Fri, 25-Feb-2022 00:51:03 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - '59' + X-Rate-Limit-Remaining: + - '148' + body: + encoding: UTF-8 + string: '{"id":"2","name":"Banco 1","number":null,"description":"","type":"bank","status":"active"}' + http_version: null + recorded_at: Wed, 26 Feb 2020 00:51:03 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/simple_category.yml b/spec/fixtures/cassettes/simple_category.yml new file mode 100644 index 0000000..2c73ff3 --- /dev/null +++ b/spec/fixtures/cassettes/simple_category.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/categories/5047 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 26 Feb 2020 00:19:38 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=stnfi2paeva1bbumgqj5faf2d5; expires=Fri, 25-Feb-2022 00:19:38 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"id":"5047","idParent":"5046","name":"Cuentas por pagar - proveedores","description":"Bajo + esta categor\u00eda se encuentran los pasivos principales","type":"liability","readOnly":false,"categoryRule":{"id":"11","name":"Cuentas + por pagar - proveedores","key":"DEBTS_TO_PAY_PROVIDERS"}}' + http_version: null + recorded_at: Wed, 26 Feb 2020 00:19:38 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/simple_user.yml b/spec/fixtures/cassettes/simple_user.yml new file mode 100644 index 0000000..e456529 --- /dev/null +++ b/spec/fixtures/cassettes/simple_user.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/users/1 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 25 Feb 2020 23:55:49 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=7ltja0o2j2d8oru9tbmems42s4; expires=Thu, 24-Feb-2022 23:55:49 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"name":null,"lastName":null,"email":"ejemploapi@dayrep.com","role":"admin","status":"active","id":"1","permissions":{"bank-accounts":{"add":"allow","transfer":"allow","view":"allow"},"bills":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"categories":{"view":"allow"},"contacts":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"company":{"edit":"allow","retrieve-info":"allow"},"invoices":{"add":"allow","edit":"allow","email":"allow","view":"allow","void":"allow","edit-items-prices":"allow"},"items":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"retentions":{"view":"allow"},"taxes":{"view":"allow"},"terms":{"view":"allow"},"payments":{"add":"allow","edit":"allow","view":"allow","edit-in":"allow","edit-out":"allow","retrieve-in":"allow","viewin":"allow","viewout":"allow"},"price-lists":{"view":"allow"},"remissions":{"add":"allow","edit":"allow","delete":"allow","view":"allow"},"estimates":{"add":"allow","delete":"allow","view":"allow","edit":"allow"},"currencies":{"index":"allow"},"sellers":{"add":"allow","edit":"allow"},"pos-cashier":{"close":"allow","index":"allow","open":"allow","view":"allow"},"pos-station":{"add":"allow","edit":"allow","view":"allow","index":"allow","delete":"allow"}}}' + http_version: null + recorded_at: Tue, 25 Feb 2020 23:55:49 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/update_completed_company.yml b/spec/fixtures/cassettes/update_completed_company.yml new file mode 100644 index 0000000..1823205 --- /dev/null +++ b/spec/fixtures/cassettes/update_completed_company.yml @@ -0,0 +1,76 @@ +--- +http_interactions: +- request: + method: put + uri: https://app.alegra.com/api/v1/company + body: + encoding: UTF-8 + string: '{"website":"nominapp.com"}' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 25 Feb 2020 15:22:00 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=ear7562h66fijh6l280qof0s55; expires=Thu, 24-Feb-2022 15:21:58 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '{"name":"ejemploapi@legra","identification":"1061687132-1","phone":"5167770","website":"nominapp.com","email":"test@test.com","regime":"Responsable + del IVA","applicationVersion":"colombia","registryDate":"2016-10-12 09:48:45","timezone":"America\/Bogota","profile":null,"address":{"city":"Medellin","department":null,"address":"calle + falsa 123","zipCode":null},"currency":{"code":"COP","symbol":"$"},"multicurrency":false,"decimalPrecision":"0","invoicePreferences":{"defaultAnotation":null,"defaultTermsAndConditions":"Esta + factura se asimila en todos sus efectos a una letra de cambio de conformidad + con el Art. 774 del c\u00f3digo de comercio. Autorizo que en caso de incumplimiento + de esta obligaci\u00f3n sea reportado a las centrales de riesgo, se cobraran + intereses por mora."},"logo":"https:\/\/d3r8o2i8390sjv.cloudfront.net\/application\/production\/company-logos\/48302296106c20092d3279f24","kindOfPerson":"","identificationObject":{"type":null,"number":"1061687132-1"},"settings":{"canStampInvoices":false,"electronicInvoicing":false}}' + http_version: null + recorded_at: Tue, 25 Feb 2020 15:22:00 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/cassettes/users.yml b/spec/fixtures/cassettes/users.yml new file mode 100644 index 0000000..de2ebe9 --- /dev/null +++ b/spec/fixtures/cassettes/users.yml @@ -0,0 +1,70 @@ +--- +http_interactions: +- request: + method: get + uri: https://app.alegra.com/api/v1/users + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v0.17.3 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Basic ZWplbXBsb2FwaUBkYXlyZXAuY29tOjA2NmIzYWIwOWU3MmQ0NTQ4ZTg4 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 25 Feb 2020 23:48:14 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Server: + - nginx + Set-Cookie: + - PHPSESSID=4460j73ltb0h7fc94u2ee17r84; expires=Thu, 24-Feb-2022 23:48:14 GMT; + Max-Age=63072000; path=/; domain=.alegra.com; secure; HttpOnly + Expires: + - Thu, 19 Nov 1981 08:52:00 GMT + Cache-Control: + - no-cache + - no-store, no-cache, must-revalidate + Pragma: + - no-cache + Vary: + - Accept + Access-Control-Max-Age: + - '86400' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, + X-HTTP-Method-Override, X-Data-Source, X-Experiment-Onb-1 + Access-Control-Allow-Methods: + - DELETE + - PUT + X-Rate-Limit-Limit: + - '150' + X-Rate-Limit-Reset: + - "-2" + X-Rate-Limit-Remaining: + - '149' + body: + encoding: UTF-8 + string: '[{"name":null,"lastName":null,"email":"ejemploapi@dayrep.com","role":"admin","status":"active","id":"1","permissions":{"bank-accounts":{"add":"allow","transfer":"allow","view":"allow"},"bills":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"categories":{"view":"allow"},"contacts":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"company":{"edit":"allow","retrieve-info":"allow"},"invoices":{"add":"allow","edit":"allow","email":"allow","view":"allow","void":"allow","edit-items-prices":"allow"},"items":{"add":"allow","delete":"allow","edit":"allow","view":"allow"},"retentions":{"view":"allow"},"taxes":{"view":"allow"},"terms":{"view":"allow"},"payments":{"add":"allow","edit":"allow","view":"allow","edit-in":"allow","edit-out":"allow","retrieve-in":"allow","viewin":"allow","viewout":"allow"},"price-lists":{"view":"allow"},"remissions":{"add":"allow","edit":"allow","delete":"allow","view":"allow"},"estimates":{"add":"allow","delete":"allow","view":"allow","edit":"allow"},"currencies":{"index":"allow"},"sellers":{"add":"allow","edit":"allow"},"pos-cashier":{"close":"allow","index":"allow","open":"allow","view":"allow"},"pos-station":{"add":"allow","edit":"allow","view":"allow","index":"allow","delete":"allow"}}}]' + http_version: null + recorded_at: Tue, 25 Feb 2020 23:48:14 GMT +recorded_with: VCR 5.1.0