-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add company, banks accounts, categories and users endpoints wrappers (#2
) * add company class with find action * add company endpoint wrapper * add alegra company endpoint basic tests * add options hash to requests, refactor code a bit and return raw response if option format == raw * add alegra record.rb and put contacts, payments and all records to inherit from it to refactor a bit * gitignore byebug history * pass options to put on company too * delete byebug historu * add wrapper with tests for users endpoints * add categories endpoint wrapper with tests * adds wrapper for bank accounts endpoint with tests * details * update readme
- Loading branch information
Miguel Ferrer Isaza
authored
Feb 26, 2020
1 parent
735486d
commit 042a180
Showing
29 changed files
with
1,566 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
.byebug_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Alegra | ||
class Record | ||
attr_reader :client | ||
|
||
def initialize(client) | ||
@client = client | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ def call(options={}) | |
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.