quaderno 1.14.0 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +56 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +2 -15
  6. data/README.md +1 -1
  7. data/Rakefile +4 -50
  8. data/changelog.md +9 -0
  9. data/lib/quaderno-ruby.rb +3 -4
  10. data/lib/quaderno-ruby/base.rb +106 -108
  11. data/lib/quaderno-ruby/behavior/block.rb +17 -19
  12. data/lib/quaderno-ruby/behavior/crud.rb +93 -95
  13. data/lib/quaderno-ruby/behavior/deliver.rb +16 -18
  14. data/lib/quaderno-ruby/behavior/payment.rb +32 -34
  15. data/lib/quaderno-ruby/behavior/retrieve.rb +23 -25
  16. data/lib/quaderno-ruby/contact.rb +6 -8
  17. data/lib/quaderno-ruby/credit.rb +10 -12
  18. data/lib/quaderno-ruby/document_item.rb +1 -3
  19. data/lib/quaderno-ruby/estimate.rb +5 -7
  20. data/lib/quaderno-ruby/evidence.rb +5 -7
  21. data/lib/quaderno-ruby/exceptions/exceptions.rb +42 -44
  22. data/lib/quaderno-ruby/expense.rb +6 -8
  23. data/lib/quaderno-ruby/helpers/authentication.rb +16 -18
  24. data/lib/quaderno-ruby/income.rb +8 -10
  25. data/lib/quaderno-ruby/invoice.rb +9 -11
  26. data/lib/quaderno-ruby/item.rb +3 -6
  27. data/lib/quaderno-ruby/payment.rb +1 -3
  28. data/lib/quaderno-ruby/receipt.rb +6 -8
  29. data/lib/quaderno-ruby/recurring.rb +4 -7
  30. data/lib/quaderno-ruby/report.rb +56 -58
  31. data/lib/quaderno-ruby/tax.rb +45 -47
  32. data/lib/quaderno-ruby/version.rb +3 -0
  33. data/lib/quaderno-ruby/webhook.rb +3 -5
  34. data/quaderno.gemspec +28 -148
  35. metadata +83 -84
  36. data/Gemfile.lock +0 -91
  37. data/VERSION +0 -1
  38. data/test/fixtures/quaderno_cassettes/.DS_Store +0 -0
  39. data/test/fixtures/quaderno_cassettes/all_contacts.yml +0 -52
  40. data/test/fixtures/quaderno_cassettes/all_contacts_by_access_token.yml +0 -56
  41. data/test/fixtures/quaderno_cassettes/all_contacts_by_authentication_token.yml +0 -57
  42. data/test/fixtures/quaderno_cassettes/all_estimates.yml +0 -52
  43. data/test/fixtures/quaderno_cassettes/all_expenses.yml +0 -55
  44. data/test/fixtures/quaderno_cassettes/all_invoices.yml +0 -56
  45. data/test/fixtures/quaderno_cassettes/all_items.yml +0 -46
  46. data/test/fixtures/quaderno_cassettes/all_receipts.yml +0 -53
  47. data/test/fixtures/quaderno_cassettes/all_webhooks.yml +0 -214
  48. data/test/fixtures/quaderno_cassettes/create_estimate_on_downgraded_API.yml +0 -156
  49. data/test/fixtures/quaderno_cassettes/create_expense_on_downgraded_API.yml +0 -278
  50. data/test/fixtures/quaderno_cassettes/create_invoice_on_downgraded_API.yml +0 -159
  51. data/test/fixtures/quaderno_cassettes/create_receipt_on_downgraded_API.yml +0 -196
  52. data/test/fixtures/quaderno_cassettes/deleted_contact.yml +0 -187
  53. data/test/fixtures/quaderno_cassettes/deleted_contact_by_access_token.yml +0 -199
  54. data/test/fixtures/quaderno_cassettes/deleted_contact_by_authentication_token.yml +0 -199
  55. data/test/fixtures/quaderno_cassettes/deleted_estimate.yml +0 -187
  56. data/test/fixtures/quaderno_cassettes/deleted_expense.yml +0 -189
  57. data/test/fixtures/quaderno_cassettes/deleted_invoice.yml +0 -190
  58. data/test/fixtures/quaderno_cassettes/deleted_item.yml +0 -128
  59. data/test/fixtures/quaderno_cassettes/deleted_receipt.yml +0 -223
  60. data/test/fixtures/quaderno_cassettes/deleted_webhook.yml +0 -257
  61. data/test/fixtures/quaderno_cassettes/delivered_estimate.yml +0 -136
  62. data/test/fixtures/quaderno_cassettes/delivered_invoice.yml +0 -143
  63. data/test/fixtures/quaderno_cassettes/delivered_receipt.yml +0 -140
  64. data/test/fixtures/quaderno_cassettes/evidence_invoice.yml +0 -98
  65. data/test/fixtures/quaderno_cassettes/found_contact.yml +0 -95
  66. data/test/fixtures/quaderno_cassettes/found_contact_by_access_token.yml +0 -99
  67. data/test/fixtures/quaderno_cassettes/found_contact_by_authentication_token.yml +0 -100
  68. data/test/fixtures/quaderno_cassettes/found_estimate.yml +0 -97
  69. data/test/fixtures/quaderno_cassettes/found_expense.yml +0 -99
  70. data/test/fixtures/quaderno_cassettes/found_invoice.yml +0 -100
  71. data/test/fixtures/quaderno_cassettes/found_item.yml +0 -91
  72. data/test/fixtures/quaderno_cassettes/found_receipt.yml +0 -98
  73. data/test/fixtures/quaderno_cassettes/found_webhook.yml +0 -130
  74. data/test/fixtures/quaderno_cassettes/new_contact.yml +0 -48
  75. data/test/fixtures/quaderno_cassettes/new_contact_by_access_token.yml +0 -48
  76. data/test/fixtures/quaderno_cassettes/new_contact_by_authentication_token.yml +0 -48
  77. data/test/fixtures/quaderno_cassettes/new_estimate.yml +0 -137
  78. data/test/fixtures/quaderno_cassettes/new_evidence.yml +0 -48
  79. data/test/fixtures/quaderno_cassettes/new_expense.yml +0 -189
  80. data/test/fixtures/quaderno_cassettes/new_invoice.yml +0 -137
  81. data/test/fixtures/quaderno_cassettes/new_item.yml +0 -48
  82. data/test/fixtures/quaderno_cassettes/new_receipt.yml +0 -173
  83. data/test/fixtures/quaderno_cassettes/new_webhook.yml +0 -87
  84. data/test/fixtures/quaderno_cassettes/paid_expense.yml +0 -98
  85. data/test/fixtures/quaderno_cassettes/paid_invoice.yml +0 -99
  86. data/test/fixtures/quaderno_cassettes/rate_limit.yml +0 -46
  87. data/test/fixtures/quaderno_cassettes/unpay_an_expense.yml +0 -138
  88. data/test/fixtures/quaderno_cassettes/unpay_an_invoice.yml +0 -138
  89. data/test/fixtures/quaderno_cassettes/updated_contact.yml +0 -97
  90. data/test/fixtures/quaderno_cassettes/updated_contact_by_access_token.yml +0 -101
  91. data/test/fixtures/quaderno_cassettes/updated_contact_by_authentication_token.yml +0 -102
  92. data/test/fixtures/quaderno_cassettes/updated_estimate.yml +0 -185
  93. data/test/fixtures/quaderno_cassettes/updated_expense.yml +0 -184
  94. data/test/fixtures/quaderno_cassettes/updated_invoice.yml +0 -184
  95. data/test/fixtures/quaderno_cassettes/updated_item.yml +0 -93
  96. data/test/fixtures/quaderno_cassettes/updated_receipt.yml +0 -220
  97. data/test/fixtures/quaderno_cassettes/updated_webhook.yml +0 -175
  98. data/test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml +0 -44
  99. data/test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml +0 -44
  100. data/test/helper.rb +0 -32
  101. data/test/unit/test_quaderno_contacts.rb +0 -83
  102. data/test/unit/test_quaderno_contacts_thread_safe.rb +0 -104
  103. data/test/unit/test_quaderno_estimates.rb +0 -155
  104. data/test/unit/test_quaderno_evidences.rb +0 -41
  105. data/test/unit/test_quaderno_expenses.rb +0 -162
  106. data/test/unit/test_quaderno_invoices.rb +0 -177
  107. data/test/unit/test_quaderno_items.rb +0 -84
  108. data/test/unit/test_quaderno_receipts.rb +0 -156
  109. data/test/unit/test_quaderno_tax.rb +0 -46
  110. data/test/unit/test_quaderno_webhooks.rb +0 -93
@@ -1,125 +1,123 @@
1
- module Quaderno
2
- module Behavior
3
- module Crud
1
+ module Quaderno::Behavior
2
+ module Crud
4
3
 
5
- def self.included(receiver)
6
- receiver.send :extend, ClassMethods
7
- end
4
+ def self.included(receiver)
5
+ receiver.send :extend, ClassMethods
6
+ end
8
7
 
9
- module ClassMethods
10
- include Quaderno::Helpers::Authentication
8
+ module ClassMethods
9
+ include Quaderno::Helpers::Authentication
11
10
 
12
- def parse_nested(element)
13
- if element.has_key?('payments')
14
- payments_collection = Array.new
15
- (element['payments'] || Array.new).each { |payment| payments_collection << Quaderno::Payment.new(payment) }
16
- element['payments'] = payments_collection
17
- end
11
+ def parse_nested(element)
12
+ if element.has_key?('payments')
13
+ payments_collection = Array.new
14
+ (element['payments'] || Array.new).each { |payment| payments_collection << Quaderno::Payment.new(payment) }
15
+ element['payments'] = payments_collection
16
+ end
18
17
 
19
- items_collection = Array.new
20
- element['items'].each { |item| items_collection << Quaderno::DocumentItem.new(item) }
21
- element['items'] = items_collection
22
- element['contact'] = Quaderno::Contact.new(element['contact'])
18
+ items_collection = Array.new
19
+ element['items'].each { |item| items_collection << Quaderno::DocumentItem.new(item) }
20
+ element['items'] = items_collection
21
+ element['contact'] = Quaderno::Contact.new(element['contact'])
23
22
 
24
- element
25
- end
23
+ element
24
+ end
26
25
 
27
- def all(options = {})
28
- authentication = get_authentication(options.merge(api_model: api_model))
29
- filter = options.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }
30
-
31
- response = get("#{authentication[:url]}#{api_model.api_path}.json",
32
- query: filter,
33
- basic_auth: authentication[:basic_auth],
34
- headers: version_header.merge(authentication[:headers])
35
- )
36
-
37
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true })
38
- array = response.parsed_response
39
- collection = Quaderno::Collection.new
40
-
41
- if is_a_document?
42
- array.each do |element|
43
- element[:authentication_data] = authentication
44
- api_model.parse_nested(element)
45
- collection << (new element)
46
- end
47
- else
48
- array.each { |element| collection << (new element) }
26
+ def all(options = {})
27
+ authentication = get_authentication(options.merge(api_model: api_model))
28
+ filter = options.delete_if { |k,v| %w(auth_token access_token api_url mode api_model).include? k.to_s }
29
+
30
+ response = get("#{authentication[:url]}#{api_model.api_path}.json",
31
+ query: filter,
32
+ basic_auth: authentication[:basic_auth],
33
+ headers: version_header.merge(authentication[:headers])
34
+ )
35
+
36
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true })
37
+ array = response.parsed_response
38
+ collection = Quaderno::Collection.new
39
+
40
+ if is_a_document?
41
+ array.each do |element|
42
+ element[:authentication_data] = authentication
43
+ api_model.parse_nested(element)
44
+ collection << (new element)
49
45
  end
46
+ else
47
+ array.each { |element| collection << (new element) }
48
+ end
50
49
 
51
- collection.current_page = response.headers['x-pages-currentpage']
52
- collection.total_pages = response.headers['x-pages-totalpages']
50
+ collection.current_page = response.headers['x-pages-currentpage']
51
+ collection.total_pages = response.headers['x-pages-totalpages']
53
52
 
54
- collection
55
- end
53
+ collection
54
+ end
56
55
 
57
- def find(id, options = {})
58
- authentication = get_authentication(options.merge(api_model: api_model))
56
+ def find(id, options = {})
57
+ authentication = get_authentication(options.merge(api_model: api_model))
59
58
 
60
- response = get("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
61
- basic_auth: authentication[:basic_auth],
62
- headers: version_header.merge(authentication[:headers])
63
- )
59
+ response = get("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
60
+ basic_auth: authentication[:basic_auth],
61
+ headers: version_header.merge(authentication[:headers])
62
+ )
64
63
 
65
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
66
- hash = response.parsed_response
67
- hash[:authentication_data] = authentication
64
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
65
+ hash = response.parsed_response
66
+ hash[:authentication_data] = authentication
68
67
 
69
- api_model.parse_nested(hash) if is_a_document?
68
+ api_model.parse_nested(hash) if is_a_document?
70
69
 
71
- new hash
72
- end
70
+ new hash
71
+ end
73
72
 
74
- def create(params = {})
75
- authentication = get_authentication(params.merge(api_model: api_model))
76
- params.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
73
+ def create(params = {})
74
+ authentication = get_authentication(params.merge(api_model: api_model))
75
+ params.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
77
76
 
78
- response = post("#{authentication[:url]}#{api_model.api_path}.json",
79
- body: params.to_json,
80
- basic_auth: authentication[:basic_auth],
81
- headers: version_header.merge(authentication[:headers]).merge('Content-Type' => 'application/json')
82
- )
77
+ response = post("#{authentication[:url]}#{api_model.api_path}.json",
78
+ body: params.to_json,
79
+ basic_auth: authentication[:basic_auth],
80
+ headers: version_header.merge(authentication[:headers]).merge('Content-Type' => 'application/json')
81
+ )
83
82
 
84
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
85
- hash = response.parsed_response
86
- hash[:authentication_data] = authentication
83
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
84
+ hash = response.parsed_response
85
+ hash[:authentication_data] = authentication
87
86
 
88
- api_model.parse_nested(hash) if is_a_document?
87
+ api_model.parse_nested(hash) if is_a_document?
89
88
 
90
- new hash
91
- end
89
+ new hash
90
+ end
92
91
 
93
- def update(id, params = {})
94
- authentication = get_authentication(params.merge(api_model: api_model))
95
- params = params.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
92
+ def update(id, params = {})
93
+ authentication = get_authentication(params.merge(api_model: api_model))
94
+ params = params.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
96
95
 
97
- response = put("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
98
- body: params.to_json,
99
- basic_auth: authentication[:basic_auth],
100
- headers: version_header.merge(authentication[:headers]).merge('Content-Type' => 'application/json')
101
- )
96
+ response = put("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
97
+ body: params.to_json,
98
+ basic_auth: authentication[:basic_auth],
99
+ headers: version_header.merge(authentication[:headers]).merge('Content-Type' => 'application/json')
100
+ )
102
101
 
103
- check_exception_for(response, { rate_limit: true, required_fields: true, subdomain_or_token: true, id: true })
104
- hash = response.parsed_response
105
- hash[:authentication_data] = authentication
102
+ check_exception_for(response, { rate_limit: true, required_fields: true, subdomain_or_token: true, id: true })
103
+ hash = response.parsed_response
104
+ hash[:authentication_data] = authentication
106
105
 
107
- api_model.parse_nested(hash) if is_a_document?
106
+ api_model.parse_nested(hash) if is_a_document?
108
107
 
109
- new hash
110
- end
108
+ new hash
109
+ end
111
110
 
112
- def delete(id, options = {})
113
- authentication = get_authentication(options.merge(api_model: api_model))
111
+ def delete(id, options = {})
112
+ authentication = get_authentication(options.merge(api_model: api_model))
114
113
 
115
- response = HTTParty.delete("#{authentication[:url]}#{ api_model.api_path }/#{ id }.json",
116
- basic_auth: authentication[:basic_auth],
117
- headers: version_header.merge(authentication[:headers])
118
- )
119
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true, has_documents: true })
114
+ response = HTTParty.delete("#{authentication[:url]}#{ api_model.api_path }/#{ id }.json",
115
+ basic_auth: authentication[:basic_auth],
116
+ headers: version_header.merge(authentication[:headers])
117
+ )
118
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true, has_documents: true })
120
119
 
121
- true
122
- end
120
+ true
123
121
  end
124
122
  end
125
123
  end
@@ -1,26 +1,24 @@
1
- module Quaderno
2
- module Behavior
3
- module Deliver
1
+ module Quaderno::Behavior
2
+ module Deliver
4
3
 
5
- def self.included(base)
6
- base.send :include, InstanceMethods
7
- end
4
+ def self.included(base)
5
+ base.send :include, InstanceMethods
6
+ end
8
7
 
9
- module InstanceMethods
10
- include Quaderno::Helpers::Authentication
8
+ module InstanceMethods
9
+ include Quaderno::Helpers::Authentication
11
10
 
12
- def deliver(options = nil)
13
- self.authentication_data = get_authentication(options.merge(api_model: api_model)) if options.is_a?(Hash)
11
+ def deliver(options = nil)
12
+ self.authentication_data = get_authentication(options.merge(api_model: api_model)) if options.is_a?(Hash)
14
13
 
15
- party_response = api_model.get("#{authentication_data[:url]}#{api_model.api_path}/#{id}/deliver.json",
16
- basic_auth: authentication_data[:basic_auth],
17
- headers: self.class.version_header.merge(authentication_data[:headers])
18
- )
14
+ party_response = api_model.get("#{authentication_data[:url]}#{api_model.api_path}/#{id}/deliver.json",
15
+ basic_auth: authentication_data[:basic_auth],
16
+ headers: self.class.version_header.merge(authentication_data[:headers])
17
+ )
19
18
 
20
- api_model.check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true, required_fields: true })
21
- { limit: party_response.headers["x-ratelimit-limit"].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
22
- end
19
+ api_model.check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true, required_fields: true })
20
+ { limit: party_response.headers["x-ratelimit-limit"].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
23
21
  end
24
22
  end
25
23
  end
26
- end
24
+ end
@@ -1,50 +1,48 @@
1
- module Quaderno
2
- module Behavior
3
- module Payment
1
+ module Quaderno::Behavior
2
+ module Payment
4
3
 
5
- def self.included(base)
6
- base.send :include, InstanceMethods
7
- end
4
+ def self.included(base)
5
+ base.send :include, InstanceMethods
6
+ end
8
7
 
9
- module InstanceMethods
10
- include Quaderno::Helpers::Authentication
8
+ module InstanceMethods
9
+ include Quaderno::Helpers::Authentication
11
10
 
12
- def add_payment(params = {})
13
- if (params.keys.map(&:to_s) & %w(auth_token access_token api_url mode api_model)).any?
14
- self.authentication_data = get_authentication(params.merge(api_model: api_model))
15
- params = params.delete_if { |k, _| %w(auth_token access_token api_url mode api_model).include? k.to_s }
16
- end
11
+ def add_payment(params = {})
12
+ if (params.keys.map(&:to_s) & %w(auth_token access_token api_url mode api_model)).any?
13
+ self.authentication_data = get_authentication(params.merge(api_model: api_model))
14
+ params = params.delete_if { |k, _| %w(auth_token access_token api_url mode api_model).include? k.to_s }
15
+ end
17
16
 
18
- response = api_model.post("#{authentication_data[:url]}#{api_model.api_path}/#{id}/payments.json",
19
- body: params,
20
- basic_auth: authentication_data[:basic_auth],
21
- headers: self.class.version_header.merge(authentication_data[:headers])
22
- )
17
+ response = api_model.post("#{authentication_data[:url]}#{api_model.api_path}/#{id}/payments.json",
18
+ body: params,
19
+ basic_auth: authentication_data[:basic_auth],
20
+ headers: self.class.version_header.merge(authentication_data[:headers])
21
+ )
23
22
 
24
- api_model.check_exception_for(response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
23
+ api_model.check_exception_for(response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
25
24
 
26
- instance = Quaderno::Payment.new(response.parsed_response)
27
- self.payments << instance
25
+ instance = Quaderno::Payment.new(response.parsed_response)
26
+ self.payments << instance
28
27
 
29
- Quaderno::Payment.new instance
30
- end
28
+ Quaderno::Payment.new instance
29
+ end
31
30
 
32
- def remove_payment(payment_id, options = nil)
33
- self.authentication_data = get_authentication(options.merge(api_model: api_model)) if options.is_a?(Hash)
31
+ def remove_payment(payment_id, options = nil)
32
+ self.authentication_data = get_authentication(options.merge(api_model: api_model)) if options.is_a?(Hash)
34
33
 
35
34
 
36
- response = HTTParty.delete("#{authentication_data[:url]}#{api_model.api_path}/#{id}/payments/#{payment_id}.json",
37
- basic_auth: authentication_data[:basic_auth],
38
- headers: self.class.version_header.merge(authentication_data[:headers])
39
- )
35
+ response = HTTParty.delete("#{authentication_data[:url]}#{api_model.api_path}/#{id}/payments/#{payment_id}.json",
36
+ basic_auth: authentication_data[:basic_auth],
37
+ headers: self.class.version_header.merge(authentication_data[:headers])
38
+ )
40
39
 
41
- api_model.check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
40
+ api_model.check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
42
41
 
43
- self.payments.delete_if { |payment| payment.id == payment_id }
42
+ self.payments.delete_if { |payment| payment.id == payment_id }
44
43
 
45
- true
46
- end
44
+ true
47
45
  end
48
46
  end
49
47
  end
50
- end
48
+ end
@@ -1,35 +1,33 @@
1
- module Quaderno
2
- module Behavior
3
- module Retrieve
1
+ module Quaderno::Behavior
2
+ module Retrieve
4
3
 
5
- def self.included(receiver)
6
- receiver.send :extend, ClassMethods
7
- end
4
+ def self.included(receiver)
5
+ receiver.send :extend, ClassMethods
6
+ end
8
7
 
9
- module ClassMethods
10
- include Quaderno::Helpers::Authentication
8
+ module ClassMethods
9
+ include Quaderno::Helpers::Authentication
11
10
 
12
- def retrieve(gateway_id, gateway = 'stripe', options = {})
13
- authentication = get_authentication(options.merge(api_model: api_model))
11
+ def retrieve(gateway_id, gateway = 'stripe', options = {})
12
+ authentication = get_authentication(options.merge(api_model: api_model))
14
13
 
15
- response = get("#{authentication[:url]}#{gateway}/#{@_retrieve_path}/#{gateway_id}.json",
16
- basic_auth: authentication[:basic_auth],
17
- headers: version_header.merge(authentication[:headers])
18
- )
14
+ response = get("#{authentication[:url]}#{gateway}/#{@_retrieve_path}/#{gateway_id}.json",
15
+ basic_auth: authentication[:basic_auth],
16
+ headers: version_header.merge(authentication[:headers])
17
+ )
19
18
 
20
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
21
- hash = response.parsed_response
22
- hash[:authentication_data] = authentication
19
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
20
+ hash = response.parsed_response
21
+ hash[:authentication_data] = authentication
23
22
 
24
- new hash
25
- end
26
- alias_method :retrieve_customer, :retrieve
23
+ new hash
24
+ end
25
+ alias_method :retrieve_customer, :retrieve
27
26
 
28
- private
29
- def retrieve_path(path)
30
- @_retrieve_path = path
31
- end
27
+ private
28
+ def retrieve_path(path)
29
+ @_retrieve_path = path
32
30
  end
33
31
  end
34
32
  end
35
- end
33
+ end
@@ -1,9 +1,7 @@
1
- module Quaderno
2
- class Contact < Base
3
- include Quaderno::Behavior::Retrieve
1
+ class Quaderno::Contact < Quaderno::Base
2
+ include Quaderno::Behavior::Retrieve
4
3
 
5
- api_model Quaderno::Contact
6
- api_path 'contacts'
7
- retrieve_path 'customers'
8
- end
9
- end
4
+ api_model Quaderno::Contact
5
+ api_path 'contacts'
6
+ retrieve_path 'customers'
7
+ end
@@ -1,13 +1,11 @@
1
- module Quaderno
2
- class Credit < Base
3
- include Quaderno::Behavior::Deliver
4
- include Quaderno::Behavior::Payment
5
- include Quaderno::Behavior::Retrieve
6
- include Quaderno::Behavior::Block
1
+ class Quaderno::Credit < Quaderno::Base
2
+ include Quaderno::Behavior::Deliver
3
+ include Quaderno::Behavior::Payment
4
+ include Quaderno::Behavior::Retrieve
5
+ include Quaderno::Behavior::Block
7
6
 
8
- api_model Quaderno::Credit
9
- api_path 'credits'
10
- retrieve_path 'refunds'
11
- is_a_document? true
12
- end
13
- end
7
+ api_model Quaderno::Credit
8
+ api_path 'credits'
9
+ retrieve_path 'refunds'
10
+ is_a_document? true
11
+ end
@@ -1,4 +1,2 @@
1
- module Quaderno
2
- class DocumentItem < OpenStruct
3
- end
1
+ class Quaderno::DocumentItem < OpenStruct
4
2
  end