ecommerce-client 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/README.md +25 -2
  4. data/ecommerce-client.gemspec +1 -0
  5. data/lib/ecommerce.rb +5 -0
  6. data/lib/ecommerce/attribute_handler.rb +1 -1
  7. data/lib/ecommerce/resources/account_order.rb +26 -0
  8. data/lib/ecommerce/resources/collection.rb +57 -0
  9. data/lib/ecommerce/resources/invoice_order.rb +52 -0
  10. data/lib/ecommerce/resources/invoice_order_collection.rb +20 -0
  11. data/lib/ecommerce/resources/invoice_plan.rb +27 -0
  12. data/lib/ecommerce/resources/order.rb +18 -13
  13. data/lib/ecommerce/resources/order_collection.rb +6 -48
  14. data/lib/ecommerce/version.rb +1 -1
  15. data/spec/ecommerce/attribute_handler_spec.rb +24 -0
  16. data/spec/ecommerce/resources/account_order_spec.rb +24 -0
  17. data/spec/ecommerce/resources/collection_spec.rb +70 -0
  18. data/spec/ecommerce/resources/invoice_order_collection_spec.rb +20 -0
  19. data/spec/ecommerce/resources/invoice_order_spec.rb +54 -0
  20. data/spec/ecommerce/resources/invoice_plan_spec.rb +23 -0
  21. data/spec/ecommerce/resources/order_collection_spec.rb +7 -69
  22. data/spec/ecommerce/resources/order_spec.rb +46 -5
  23. data/spec/spec_helper.rb +3 -0
  24. data/spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_not_found_raises_NotFound.yml +219 -0
  25. data/spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_success_returns_a_find_all_of_orders.yml +297 -0
  26. data/spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_not_found_raises_NotFound.yml +30 -0
  27. data/spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_success_returns_a_find_all_of_orders.yml +73 -0
  28. data/spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_not_found_raises_NotFound.yml +46 -0
  29. data/spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_success_returns_order_object.yml +59 -0
  30. data/spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_not_found_raises_NotFound.yml +46 -0
  31. data/spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_success_returns_a_find_all_of_orders.yml +63 -0
  32. data/spec/vcr_cassettes/Ecommerce/Resources_Order_update_when_sending_not_all_required_parameters_raises_error_BarRequ.yml +49 -0
  33. data/spec/vcr_cassettes/Ecommerce/Resources_Order_update_with_success_returns_order_information_on_body.yml +61 -0
  34. metadata +52 -3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/2704/invoices/paid/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":"wrong-slug","limit":20}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.2
12
+ Accept:
13
+ - application/json
14
+ Content-Type:
15
+ - application/json
16
+ Authorization:
17
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: NOT FOUND
22
+ headers:
23
+ Allow:
24
+ - GET, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Thu, 02 Apr 2015 20:41:49 GMT
31
+ Server:
32
+ - nginx/1.6.2
33
+ Vary:
34
+ - Authenticate, Accept, Accept-Language, Cookie
35
+ Content-Length:
36
+ - '0'
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: ''
42
+ http_version: '1.1'
43
+ adapter_metadata:
44
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/2704/invoices/paid/
45
+ recorded_at: Thu, 02 Apr 2015 20:41:49 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/rexpense-custom-monthly-brl-5250/invoices/paid/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1,"limit":20}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.2
12
+ Accept:
13
+ - application/json
14
+ Content-Type:
15
+ - application/json
16
+ Authorization:
17
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Allow:
24
+ - GET, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Thu, 02 Apr 2015 20:41:47 GMT
31
+ ETag:
32
+ - '"1586515086099841473"'
33
+ Link:
34
+ - "<http://sandbox.ecommerce.myfreecomm.com.br/api/rexpense-custom-monthly-brl-5250/invoices/paid/?page=1>;
35
+ rel=last, <http://sandbox.ecommerce.myfreecomm.com.br/api/rexpense-custom-monthly-brl-5250/invoices/paid/?page=1>;
36
+ rel=first"
37
+ Server:
38
+ - nginx/1.6.2
39
+ Vary:
40
+ - Authenticate, Accept, Accept-Language, Cookie
41
+ Content-Length:
42
+ - '1007'
43
+ Connection:
44
+ - keep-alive
45
+ body:
46
+ encoding: UTF-8
47
+ string: '[{"redeemed_adjustments": [], "order_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2704/",
48
+ "url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2704/invoices/2544/",
49
+ "created_at": "2015-04-02 15:27:55", "activated_at": "2015-04-02 15:28:49",
50
+ "number": 2544, "user_data": {"address_city": "RJ", "address_complement":
51
+ "41", "address_number": "41", "address_quarter": "Bla", "client_name": "Teste",
52
+ "address_state": "RJ", "client_email": "jaime.lannister@mailinator.com", "address":
53
+ "Rua sem numero", "document_number": "05793832000126", "zip_code": "20231030"},
54
+ "amount_with_adjustments": "52.00", "amount": "52.00", "paid_at": "2015-04-02
55
+ 15:28:45", "payment_method": "buypage :: visa", "plan_data": {"slug": "rexpense-custom-monthly-brl-5250",
56
+ "name": "rexpense-custom-monthly-brl-5250", "description": "Rexpense monthly
57
+ for 5 users (10,50 BRL each)"}, "charge_date": "2015-04-02", "next_payment_date":
58
+ "2015-05-02"}]'
59
+ http_version: '1.1'
60
+ adapter_metadata:
61
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/rexpense-custom-monthly-brl-5250/invoices/paid/
62
+ recorded_at: Thu, 02 Apr 2015 20:41:48 GMT
63
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"identity":"8923199e-6c43-415a-bbd1-2e302fdf8d96","client_email":"jaime.lannister@mailinator.com","client_name":"Jaime
9
+ Lannister KingSlayer"}'
10
+ headers:
11
+ User-Agent:
12
+ - Ecommerce Ruby Client v0.0.2
13
+ Accept:
14
+ - application/json
15
+ Content-Type:
16
+ - application/json
17
+ Authorization:
18
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
19
+ response:
20
+ status:
21
+ code: 400
22
+ message: BAD REQUEST
23
+ headers:
24
+ Allow:
25
+ - GET, PUT, DELETE, HEAD, OPTIONS
26
+ Content-Language:
27
+ - pt-br
28
+ Content-Type:
29
+ - application/json
30
+ Date:
31
+ - Tue, 31 Mar 2015 21:11:27 GMT
32
+ ETag:
33
+ - '"7494782765793939230"'
34
+ Server:
35
+ - nginx/1.6.2
36
+ Vary:
37
+ - Authenticate, Accept, Accept-Language, Cookie
38
+ Content-Length:
39
+ - '78'
40
+ Connection:
41
+ - keep-alive
42
+ body:
43
+ encoding: UTF-8
44
+ string: '{"field_errors": {"document_number": ["Este campo \u00e9 obrigat\u00f3rio."]}}'
45
+ http_version: '1.1'
46
+ adapter_metadata:
47
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/
48
+ recorded_at: Tue, 31 Mar 2015 21:11:28 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"document_number":"976.305.273-49","identity":"8923199e-6c43-415a-bbd1-2e302fdf8d96","client_email":"jaime.lannister@mailinator.com","client_name":"Jaime
9
+ Lannister KingSlayer"}'
10
+ headers:
11
+ User-Agent:
12
+ - Ecommerce Ruby Client v0.0.2
13
+ Accept:
14
+ - application/json
15
+ Content-Type:
16
+ - application/json
17
+ Authorization:
18
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Allow:
25
+ - GET, PUT, DELETE, HEAD, OPTIONS
26
+ Content-Language:
27
+ - pt-br
28
+ Content-Type:
29
+ - application/json
30
+ Date:
31
+ - Tue, 31 Mar 2015 21:08:17 GMT
32
+ ETag:
33
+ - '"-4936528050792143463"'
34
+ Server:
35
+ - nginx/1.6.2
36
+ Vary:
37
+ - Authenticate, Accept, Accept-Language, Cookie
38
+ transfer-encoding:
39
+ - chunked
40
+ Connection:
41
+ - keep-alive
42
+ body:
43
+ encoding: UTF-8
44
+ string: '{"is_paid": false, "address_number": null, "plan_change_urls": {"rexpense-beta":
45
+ "http://sandbox.ecommerce.myfreecomm.com.br/rexpense-custom-monthly-brl-5250/2608/change/rexpense-beta/"},
46
+ "activation_expired": false, "number": 2608, "address_state": "", "global_account":
47
+ "e5732007-7989-4372-8e72-9ec8cf6ee046", "api_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/",
48
+ "is_trial": false, "document_number": "97630527349", "checkout_url": "http://sandbox.ecommerce.myfreecomm.com.br/rexpense-custom-monthly-brl-5250/2608/checkout/",
49
+ "active_until": null, "charge_day": 25, "address_quarter": null, "activated_at":
50
+ null, "is_active": false, "user_code": "", "address": null, "is_recurring":
51
+ true, "address_city": null, "plan_slug": "rexpense-custom-monthly-brl-5250",
52
+ "address_complement": "", "discounts_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/discounts/",
53
+ "created_at": "2015-03-25 17:54:42", "adjustments_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/adjustments/",
54
+ "next_payment_at": null, "amount": "52.50", "client_email": "jaime.lannister@mailinator.com",
55
+ "zip_code": null, "client_name": "Jaime Lannister KingSlayer", "invoices_url":
56
+ "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/invoices/"}'
57
+ http_version: '1.1'
58
+ adapter_metadata:
59
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/2608/
60
+ recorded_at: Tue, 31 Mar 2015 21:08:19 GMT
61
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecommerce-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael B. Tauil
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-27 00:00:00.000000000 Z
13
+ date: 2015-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
@@ -110,6 +110,20 @@ dependencies:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: '2.9'
113
+ - !ruby/object:Gem::Dependency
114
+ name: codeclimate-test-reporter
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.4'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '0.4'
113
127
  description: Official Ruby client for Myfreecomm's Ecommerce API. Ecommerce is a solution
114
128
  to control payments for your products.
115
129
  email:
@@ -133,7 +147,12 @@ files:
133
147
  - lib/ecommerce/configuration.rb
134
148
  - lib/ecommerce/exception.rb
135
149
  - lib/ecommerce/request.rb
150
+ - lib/ecommerce/resources/account_order.rb
136
151
  - lib/ecommerce/resources/base.rb
152
+ - lib/ecommerce/resources/collection.rb
153
+ - lib/ecommerce/resources/invoice_order.rb
154
+ - lib/ecommerce/resources/invoice_order_collection.rb
155
+ - lib/ecommerce/resources/invoice_plan.rb
137
156
  - lib/ecommerce/resources/order.rb
138
157
  - lib/ecommerce/resources/order_collection.rb
139
158
  - lib/ecommerce/response.rb
@@ -142,12 +161,25 @@ files:
142
161
  - spec/ecommerce/client_spec.rb
143
162
  - spec/ecommerce/configuration_spec.rb
144
163
  - spec/ecommerce/request_spec.rb
164
+ - spec/ecommerce/resources/account_order_spec.rb
165
+ - spec/ecommerce/resources/collection_spec.rb
166
+ - spec/ecommerce/resources/invoice_order_collection_spec.rb
167
+ - spec/ecommerce/resources/invoice_order_spec.rb
168
+ - spec/ecommerce/resources/invoice_plan_spec.rb
145
169
  - spec/ecommerce/resources/order_collection_spec.rb
146
170
  - spec/ecommerce/resources/order_spec.rb
147
171
  - spec/ecommerce/response_spec.rb
148
172
  - spec/ecommerce_spec.rb
149
173
  - spec/spec_helper.rb
150
174
  - spec/support/vcr.rb
175
+ - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_not_found_raises_NotFound.yml
176
+ - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_success_returns_a_find_all_of_orders.yml
177
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_not_found_raises_NotFound.yml
178
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_success_returns_a_find_all_of_orders.yml
179
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_not_found_raises_NotFound.yml
180
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_success_returns_order_object.yml
181
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_not_found_raises_NotFound.yml
182
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_success_returns_a_find_all_of_orders.yml
151
183
  - spec/vcr_cassettes/Ecommerce/Resources_Order_create_when_success_returns_body.yml
152
184
  - spec/vcr_cassettes/Ecommerce/Resources_Order_create_when_success_when_sending_not_all_required_parameters_raises_.yml
153
185
  - spec/vcr_cassettes/Ecommerce/Resources_Order_destroy_when_not_found_raises_NotFound.yml
@@ -156,6 +188,8 @@ files:
156
188
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_all_when_success_returns_a_find_all_of_orders.yml
157
189
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_when_not_found_raises_NotFound.yml
158
190
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_when_success_returns_order_object.yml
191
+ - spec/vcr_cassettes/Ecommerce/Resources_Order_update_when_sending_not_all_required_parameters_raises_error_BarRequ.yml
192
+ - spec/vcr_cassettes/Ecommerce/Resources_Order_update_with_success_returns_order_information_on_body.yml
159
193
  - spec/vcr_cassettes/client/authenticated/false.yml
160
194
  - spec/vcr_cassettes/client/authenticated/true.yml
161
195
  - tasks/rspec.rake
@@ -179,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
213
  version: '0'
180
214
  requirements: []
181
215
  rubyforge_project:
182
- rubygems_version: 2.4.5
216
+ rubygems_version: 2.2.2
183
217
  signing_key:
184
218
  specification_version: 4
185
219
  summary: Official Ruby client for Myfreecomm's Ecommerce API.
@@ -188,12 +222,25 @@ test_files:
188
222
  - spec/ecommerce/client_spec.rb
189
223
  - spec/ecommerce/configuration_spec.rb
190
224
  - spec/ecommerce/request_spec.rb
225
+ - spec/ecommerce/resources/account_order_spec.rb
226
+ - spec/ecommerce/resources/collection_spec.rb
227
+ - spec/ecommerce/resources/invoice_order_collection_spec.rb
228
+ - spec/ecommerce/resources/invoice_order_spec.rb
229
+ - spec/ecommerce/resources/invoice_plan_spec.rb
191
230
  - spec/ecommerce/resources/order_collection_spec.rb
192
231
  - spec/ecommerce/resources/order_spec.rb
193
232
  - spec/ecommerce/response_spec.rb
194
233
  - spec/ecommerce_spec.rb
195
234
  - spec/spec_helper.rb
196
235
  - spec/support/vcr.rb
236
+ - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_not_found_raises_NotFound.yml
237
+ - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_success_returns_a_find_all_of_orders.yml
238
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_not_found_raises_NotFound.yml
239
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_success_returns_a_find_all_of_orders.yml
240
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_not_found_raises_NotFound.yml
241
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_success_returns_order_object.yml
242
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_not_found_raises_NotFound.yml
243
+ - spec/vcr_cassettes/Ecommerce/Resources_InvoicePlan_find_all_when_success_returns_a_find_all_of_orders.yml
197
244
  - spec/vcr_cassettes/Ecommerce/Resources_Order_create_when_success_returns_body.yml
198
245
  - spec/vcr_cassettes/Ecommerce/Resources_Order_create_when_success_when_sending_not_all_required_parameters_raises_.yml
199
246
  - spec/vcr_cassettes/Ecommerce/Resources_Order_destroy_when_not_found_raises_NotFound.yml
@@ -202,5 +249,7 @@ test_files:
202
249
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_all_when_success_returns_a_find_all_of_orders.yml
203
250
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_when_not_found_raises_NotFound.yml
204
251
  - spec/vcr_cassettes/Ecommerce/Resources_Order_find_when_success_returns_order_object.yml
252
+ - spec/vcr_cassettes/Ecommerce/Resources_Order_update_when_sending_not_all_required_parameters_raises_error_BarRequ.yml
253
+ - spec/vcr_cassettes/Ecommerce/Resources_Order_update_with_success_returns_order_information_on_body.yml
205
254
  - spec/vcr_cassettes/client/authenticated/false.yml
206
255
  - spec/vcr_cassettes/client/authenticated/true.yml