Class: Quaderno::Report

Inherits:
Base
  • Object
show all
Defined in:
lib/quaderno-ruby/report.rb

Constant Summary

Constants inherited from Base

Base::PRODUCTION_URL, Base::SANDBOX_URL

Class Method Summary collapse

Methods inherited from Base

api_model, api_version=, auth_token=, authorization, configure, me, ping, #to_hash, url=, user_agent_header=

Methods included from Helpers::RateLimit

#rate_limit_info, #rate_limit_info=

Methods included from Helpers::Authentication

#get_authentication

Methods included from Behavior::Crud

included

Methods included from Exceptions

included

Class Method Details

.domestic_taxes(options = {}) ⇒ Object



39
40
41
# File 'lib/quaderno-ruby/report.rb', line 39

def self.domestic_taxes(options = {})
  request_tax_report('domestic_taxes', options)
end

.ec_sales(options = {}) ⇒ Object



51
52
53
# File 'lib/quaderno-ruby/report.rb', line 51

def self.ec_sales(options = {})
  request_tax_report('ec_sales', options)
end

.international_taxes(options = {}) ⇒ Object



55
56
57
# File 'lib/quaderno-ruby/report.rb', line 55

def self.international_taxes(options = {})
  request_tax_report('international_taxes', options)
end

.journal(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/quaderno-ruby/report.rb', line 9

def self.journal(options = {})
  authentication = get_authentication(options.merge(api_model: api_model))
  filter = options.dup.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }

  response = get("#{authentication[:url]}#{api_model.api_path}/journal.json",
    query: filter,
    basic_auth: authentication[:basic_auth],
    headers: default_headers.merge(authentication[:headers])
  )

  check_exception_for(response, { rate_limit: true, subdomain_or_token: true })

  response.parsed_response
end

.sales_taxes(options = {}) ⇒ Object



43
44
45
# File 'lib/quaderno-ruby/report.rb', line 43

def self.sales_taxes(options = {})
  request_tax_report('sales_taxes', options)
end

.taxes(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/quaderno-ruby/report.rb', line 24

def self.taxes(options = {})
  authentication = get_authentication(options.merge(api_model: api_model))
  filter = options.dup.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }

  response = get("#{authentication[:url]}#{api_model.api_path}/taxes.json",
    query: filter,
    basic_auth: authentication[:basic_auth],
    headers: default_headers.merge(authentication[:headers])
  )

  check_exception_for(response, { rate_limit: true, subdomain_or_token: true })

  response.parsed_response
end

.vat_moss(options = {}) ⇒ Object



47
48
49
# File 'lib/quaderno-ruby/report.rb', line 47

def self.vat_moss(options = {})
  request_tax_report('vat_moss', options)
end