Module: Contaazul::Request
- Included in:
- Client
- Defined in:
- lib/contaazul/request.rb
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #patch(path, options = {}) ⇒ Object
- #post(path, options = {}) ⇒ Object
Instance Method Details
#delete(path, options = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/contaazul/request.rb', line 56 def delete(path, ={}) conn = Faraday.new(:url => self.api_endpoint) do |faraday| faraday.adapter Faraday.default_adapter end conn.headers["CompanyToken"] = self.company_token || ""; conn.headers["ExternalApplicationToken"] = self.external_token || ""; puts "" puts "[ContaAzul] Endpoint/Path: #{self.api_endpoint}/#{path}" puts "[ContaAzul] CompanyToken: #{self.company_token}" puts "[ContaAzul] External: #{self.external_token}" puts "" response = conn.delete(path) response.body end |
#get(path, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/contaazul/request.rb', line 5 def get(path, ={}) conn = Faraday.new(:url => self.api_endpoint) do |faraday| faraday.adapter Faraday.default_adapter end conn.headers["CompanyToken"] = self.company_token || ""; conn.headers["ExternalApplicationToken"] = self.external_token || ""; puts "" puts "[ContaAzul] Endpoint/Path: #{self.api_endpoint}/#{path}" puts "[ContaAzul] CompanyToken: #{self.company_token}" puts "[ContaAzul] External: #{self.external_token}" puts "" response = conn.get(path) response.body end |
#patch(path, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/contaazul/request.rb', line 22 def patch(path, ={}) conn = Faraday.new(:url => self.api_endpoint) do |faraday| faraday.adapter Faraday.default_adapter end conn.headers["CompanyToken"] = self.company_token || ""; conn.headers["ExternalApplicationToken"] = self.external_token || ""; puts "" puts "[ContaAzul] Endpoint/Path: #{self.api_endpoint}/#{path}" puts "[ContaAzul] CompanyToken: #{self.company_token}" puts "[ContaAzul] External: #{self.external_token}" puts "" response = conn.patch(path) response.body end |
#post(path, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/contaazul/request.rb', line 39 def post(path, ={}) conn = Faraday.new(:url => self.api_endpoint) do |faraday| faraday.adapter Faraday.default_adapter end conn.headers["CompanyToken"] = self.company_token || ""; conn.headers["ExternalApplicationToken"] = self.external_token || ""; puts "" puts "[ContaAzul] Endpoint/Path: #{self.api_endpoint}/#{path}" puts "[ContaAzul] CompanyToken: #{self.company_token}" puts "[ContaAzul] External: #{self.external_token}" puts "" response = conn.post(path, ) response.body end |