ecommerce-client 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 372faf95c34b3244ee4aa37429bf146c59df0541
4
- data.tar.gz: a86671860634547190e26e59d38935ec23949cad
3
+ metadata.gz: 204da90ba7c5da8ab04eb60727a4c5d5c86b3bec
4
+ data.tar.gz: 2c4185dab926feb7e8aeada58f3ee2250b9566fc
5
5
  SHA512:
6
- metadata.gz: 5af1bcf38deac81ff229e0e654446d9d4c658ca849b47a096c1c5fe8826bd9b843b9c300cfb71eac6f5a471853c4141191628cca22078bc525869534d5a58ead
7
- data.tar.gz: f32b025ac5266fd9873bf7512ea7d05541ef6fae88810ea6645f291d63aa28ec61968f6ad598e9c69e4be761a2336e963dec921f8310f9fa182e7ca5f5241e93
6
+ metadata.gz: 894275f5c25b90ce78069a020e66a371dd5f6778ac67492cfab64421364769c00c318e9a1060edd8e31783bd18c468a4d9cb7ae1a313a4d4e070ffe90e39c95e
7
+ data.tar.gz: e587c033871af88b35858826d58c7add8af976875ac1a73f426f52f535f52bdb87aa4ba2e1284b73f4e9cdba4816eb37bf8cfd3c0d88dd748107f575ed8fcff8
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.6
5
+ - 2.2.2
@@ -14,6 +14,8 @@ require "ecommerce/resources/order_collection"
14
14
  require "ecommerce/resources/invoice_order"
15
15
  require "ecommerce/resources/invoice_order_collection"
16
16
  require "ecommerce/resources/invoice_plan"
17
+ require "ecommerce/resources/adjustment_order"
18
+ require "ecommerce/resources/adjustment_order_collection"
17
19
 
18
20
  module Ecommerce
19
21
  def self.configuration
@@ -0,0 +1,83 @@
1
+ module Ecommerce
2
+ module Resources
3
+ #
4
+ # A wrapper to Ecommerce adjusments orders API
5
+ #
6
+ # [API]
7
+ # Documentation: http://myfreecomm.github.io/passaporte-web/ecommerce/api/index.html
8
+ #
9
+ class AdjustmentOrder < Base
10
+ attr_reader :url, :amount, :description, :valid_until, :valid_from
11
+
12
+ #
13
+ # Adjustment order API does not return the ID field
14
+ #
15
+ def id
16
+ url.split('/')[8].to_i
17
+ end
18
+
19
+ #
20
+ # Creates an Adjustment order
21
+ #
22
+ # [API]
23
+ # Method: <tt>POST /api/orders/:slug/:id/adjustments/</tt>
24
+ #
25
+ # Documentation: http://myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#criacao-de-alteracao-de-valor-para-uma-ordem-de-compra
26
+ #
27
+ def self.create(slug, order_id, params)
28
+ client.post("/api/orders/#{slug}/#{order_id}/adjustments/", body: params) do |response|
29
+ build(response)
30
+ end
31
+ end
32
+
33
+ #
34
+ # Lists all Adjustments orders of an order and return a collection
35
+ # and pagination information (represented by Ecommerce::Resources::AdjustmentOrderCollection)
36
+ #
37
+ # [API]
38
+ # Method: <tt>GET /api/orders/:slug/adjustments/</tt>
39
+ #
40
+ # Documentation: http://myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#listagem-das-alteracoes-de-valor-associadas-a-uma-ordem-de-compra
41
+ #
42
+ def self.find_all(slug, order_id, page = 1, limit = 20)
43
+ body = { page: page, limit: limit }
44
+ client.get("/api/orders/#{slug}/#{order_id}/adjustments/", body: body) do |response|
45
+ Ecommerce::Resources::AdjustmentOrderCollection.build(response)
46
+ end
47
+ end
48
+
49
+ #
50
+ # Finds an Adjustment order
51
+ #
52
+ # [API]
53
+ # Method: <tt>GET /api/orders/:slug/:order_id/adjustments/:id/</tt>
54
+ #
55
+ # Documentation: http://myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#obtencao-dos-dados-de-uma-alteracao-de-valor
56
+ #
57
+ def self.find(slug, order_id, id)
58
+ client.get("/api/orders/#{slug}/#{order_id}/adjustments/#{id}/") do |response|
59
+ build(response)
60
+ end
61
+ end
62
+
63
+ #
64
+ # Destroys an Adjustment order
65
+ #
66
+ # [API]
67
+ # Method: <tt>DELETE /api/orders/:slug/:order_id/adjustments/:id/</tt>
68
+ #
69
+ # Documentation: http://myfreecomm.github.io/passaporte-web/ecommerce/api/orders.html#remocao-de-uma-alteracao-de-valor
70
+ #
71
+ def self.destroy(order_id, slug, id)
72
+ client.delete("/api/orders/#{slug}/#{order_id}/adjustments/#{id}/") do |response|
73
+ build(response)
74
+ end
75
+ end
76
+
77
+ def self.build(response)
78
+ attributes = parsed_body(response)
79
+ attributes.empty? ? {} : new(attributes)
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,16 @@
1
+ module Ecommerce
2
+ module Resources
3
+ #
4
+ # A wrapper to Ecommerce adjustments orders API.
5
+ #
6
+ class AdjustmentOrderCollection < Collection
7
+ private
8
+
9
+ def build_collection
10
+ Ecommerce::Resources::Base.parsed_body(response).each do |adjustment_order_attributes|
11
+ collection.push(Ecommerce::Resources::AdjustmentOrder.new(adjustment_order_attributes))
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -11,7 +11,7 @@ module Ecommerce
11
11
  def initialize(response)
12
12
  @response = response
13
13
  @collection = []
14
- @headers = response.headers['Link'].split(',')
14
+ @headers = response.headers['Link'].split(',') if response.headers['Link']
15
15
  end
16
16
 
17
17
  def self.build(response)
@@ -1,3 +1,3 @@
1
1
  module Ecommerce
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,89 @@
1
+ require "spec_helper"
2
+
3
+ describe Ecommerce::Resources::AdjustmentOrder do
4
+ describe '.create', vcr: true do
5
+ let(:params) { { amount: 50.60, description: 'New promotion', valid_from: '2015-05-27', valid_until: '2015-06-27' } }
6
+ subject { described_class.create('rexpense-custom-monthly-brl-5250', 3001, params) }
7
+
8
+ context 'when success' do
9
+ it 'returns adjustment created body' do
10
+ expect(subject.amount).to eq(50.6)
11
+ expect(subject.description).to eq('New promotion')
12
+ expect(subject.valid_from).to eq(Date.new(2015, 5, 27))
13
+ expect(subject.valid_until).to eq(Date.new(2015, 6, 27))
14
+ end
15
+
16
+ context 'when sending not all required parameters' do
17
+ before { params.delete(:amount) }
18
+
19
+ it 'raises error RequestError' do
20
+ expect{subject}.to raise_error(Ecommerce::RequestError)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ describe '.find_all', vcr: true do
27
+ context 'when success' do
28
+ subject { described_class.find_all('rexpense-custom-monthly-brl-5250', 3001) }
29
+
30
+ it 'returns a find_all of orders' do
31
+ expect(subject.class).to eq(Ecommerce::Resources::AdjustmentOrderCollection)
32
+ expect(subject.collection.first.description).to eq('New promotion')
33
+ expect(subject.collection.first.url).to eq('http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/')
34
+ expect(subject.collection.first.amount).to eq(50.6)
35
+ expect(subject.collection.first.class).to eq(Ecommerce::Resources::AdjustmentOrder)
36
+ expect(subject.collection.count).to eq(1)
37
+ end
38
+ end
39
+
40
+ context 'when not found' do
41
+ subject { described_class.find_all('wrong-slug', 3001) }
42
+
43
+ it 'raises RequestError' do
44
+ expect{ subject }.to raise_error(Ecommerce::RequestError)
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '.find', vcr: true do
50
+ context 'when success' do
51
+ subject { described_class.find('rexpense-custom-monthly-brl-5250', 3001, 201) }
52
+
53
+ it 'returns adjustment order object' do
54
+ expect(subject.amount).to eq(50.6)
55
+ expect(subject.description).to eq('New promotion')
56
+ expect(subject.valid_from).to eq(Date.new(2015, 5, 27))
57
+ expect(subject.valid_until).to eq(Date.new(2015, 6, 27))
58
+ expect(subject.url).to eq('http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/')
59
+ expect(subject.id).to eq(201)
60
+ end
61
+ end
62
+
63
+ context 'when not found' do
64
+ subject { described_class.find('wrong-slug', 3001, 201) }
65
+
66
+ it 'raises NotFound' do
67
+ expect{ subject }.to raise_error(Ecommerce::RequestError)
68
+ end
69
+ end
70
+ end
71
+
72
+ describe '.destroy', vcr: true do
73
+ context 'when success' do
74
+ subject { described_class.destroy(3001, 'rexpense-custom-monthly-brl-5250', 201) }
75
+
76
+ it 'returns empty body' do
77
+ expect(subject).to be_empty
78
+ end
79
+ end
80
+
81
+ context 'when not found' do
82
+ subject { described_class.destroy(3001, 'wrong-slug', 201) }
83
+
84
+ it 'raises NotFound' do
85
+ expect{ subject }.to raise_error(Ecommerce::RequestError)
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"amount":50.6,"description":"New promotion","valid_from":"2015-05-27","valid_until":"2015-06-27"}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
12
+ Accept:
13
+ - application/json
14
+ Content-Type:
15
+ - application/json
16
+ Authorization:
17
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: CREATED
22
+ headers:
23
+ Allow:
24
+ - GET, POST, HEAD, OPTIONS
25
+ Cache-Control:
26
+ - no-cache
27
+ Cache-Timeout:
28
+ - "-1"
29
+ Content-Language:
30
+ - pt-br
31
+ Content-Type:
32
+ - application/json
33
+ Date:
34
+ - Wed, 27 May 2015 15:10:04 GMT
35
+ Expires:
36
+ - Wed, 27 May 2015 12:10:04
37
+ Server:
38
+ - nginx/1.8.0
39
+ Vary:
40
+ - Authenticate, Accept, Accept-Language, Cookie
41
+ Content-Length:
42
+ - '376'
43
+ Connection:
44
+ - keep-alive
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"valid_until": "2015-06-27", "redeemed_amount": 0, "valid_from": "2015-05-27",
48
+ "description": "New promotion", "url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/",
49
+ "amount": "50.6", "order_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/",
50
+ "redemptions": []}'
51
+ http_version: '1.1'
52
+ adapter_metadata:
53
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
54
+ recorded_at: Wed, 27 May 2015 15:10:05 GMT
55
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"description":"New promotion","valid_from":"2015-05-27","valid_until":"2015-06-27"}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
12
+ Accept:
13
+ - application/json
14
+ Content-Type:
15
+ - application/json
16
+ Authorization:
17
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
18
+ response:
19
+ status:
20
+ code: 400
21
+ message: BAD REQUEST
22
+ headers:
23
+ Allow:
24
+ - GET, POST, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:10:44 GMT
31
+ ETag:
32
+ - '"2791279433870516591"'
33
+ Server:
34
+ - nginx/1.8.0
35
+ Vary:
36
+ - Authenticate, Accept, Accept-Language, Cookie
37
+ Content-Length:
38
+ - '69'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"field_errors": {"amount": ["Este campo \u00e9 obrigat\u00f3rio."]}}'
44
+ http_version: '1.1'
45
+ adapter_metadata:
46
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
47
+ recorded_at: Wed, 27 May 2015 15:10:44 GMT
48
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/wrong-slug/3001/adjustments/201/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, DELETE, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:36:06 GMT
31
+ Server:
32
+ - nginx/1.8.0
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/orders/wrong-slug/3001/adjustments/201/
45
+ recorded_at: Wed, 27 May 2015 15:36:06 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
12
+ Accept:
13
+ - application/json
14
+ Content-Type:
15
+ - application/json
16
+ Authorization:
17
+ - Basic cDlhWXNSU0l2TTo0MWUxMzc2OGI0N2Q1NTM0MTdiNDQxYjg2M2Jh
18
+ response:
19
+ status:
20
+ code: 204
21
+ message: NO CONTENT
22
+ headers:
23
+ Allow:
24
+ - GET, DELETE, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Length:
28
+ - '0'
29
+ Content-Type:
30
+ - application/json
31
+ Date:
32
+ - Wed, 27 May 2015 15:36:04 GMT
33
+ ETag:
34
+ - '"-4645357772151842967"'
35
+ Server:
36
+ - nginx/1.8.0
37
+ Vary:
38
+ - Authenticate, Accept, Accept-Language, Cookie
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version: '1.1'
45
+ adapter_metadata:
46
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/
47
+ recorded_at: Wed, 27 May 2015 15:36:05 GMT
48
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/wrong-slug/3001/adjustments/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1,"limit":20}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, POST, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:20:58 GMT
31
+ Server:
32
+ - nginx/1.8.0
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/orders/wrong-slug/3001/adjustments/
45
+ recorded_at: Wed, 27 May 2015 15:20:58 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/wrong-slug/3001/adjustments/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1,"limit":20}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, POST, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:21:04 GMT
31
+ Server:
32
+ - nginx/1.8.0
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/orders/wrong-slug/3001/adjustments/
45
+ recorded_at: Wed, 27 May 2015 15:21:04 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1,"limit":20}'
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, POST, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:18:23 GMT
31
+ ETag:
32
+ - '"2791279433870516591"'
33
+ Server:
34
+ - nginx/1.8.0
35
+ Vary:
36
+ - Authenticate, Accept, Accept-Language, Cookie
37
+ Content-Length:
38
+ - '379'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: '[{"valid_until": "2015-06-27", "redeemed_amount": 0, "valid_from":
44
+ "2015-05-27", "description": "New promotion", "url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/",
45
+ "amount": "50.60", "order_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/",
46
+ "redemptions": []}]'
47
+ http_version: '1.1'
48
+ adapter_metadata:
49
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/
50
+ recorded_at: Wed, 27 May 2015 15:18:23 GMT
51
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/wrong-slug/3001/adjustments/201/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, DELETE, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:30:22 GMT
31
+ Server:
32
+ - nginx/1.8.0
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/orders/wrong-slug/3001/adjustments/201/
45
+ recorded_at: Wed, 27 May 2015 15:30:23 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Ecommerce Ruby Client v0.0.3
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, DELETE, HEAD, OPTIONS
25
+ Content-Language:
26
+ - pt-br
27
+ Content-Type:
28
+ - application/json
29
+ Date:
30
+ - Wed, 27 May 2015 15:30:21 GMT
31
+ ETag:
32
+ - '"-4645357772151842967"'
33
+ Server:
34
+ - nginx/1.8.0
35
+ Vary:
36
+ - Authenticate, Accept, Accept-Language, Cookie
37
+ Content-Length:
38
+ - '377'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"valid_until": "2015-06-27", "redeemed_amount": 0, "valid_from": "2015-05-27",
44
+ "description": "New promotion", "url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/",
45
+ "amount": "50.60", "order_url": "http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/",
46
+ "redemptions": []}'
47
+ http_version: '1.1'
48
+ adapter_metadata:
49
+ effective_url: http://sandbox.ecommerce.myfreecomm.com.br/api/orders/rexpense-custom-monthly-brl-5250/3001/adjustments/201/
50
+ recorded_at: Wed, 27 May 2015 15:30:21 GMT
51
+ 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.3
4
+ version: 0.0.4
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-04-06 00:00:00.000000000 Z
13
+ date: 2015-05-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
@@ -136,6 +136,7 @@ extra_rdoc_files: []
136
136
  files:
137
137
  - ".gitignore"
138
138
  - ".rspec"
139
+ - ".travis.yml"
139
140
  - Gemfile
140
141
  - LICENSE.txt
141
142
  - README.md
@@ -148,6 +149,8 @@ files:
148
149
  - lib/ecommerce/exception.rb
149
150
  - lib/ecommerce/request.rb
150
151
  - lib/ecommerce/resources/account_order.rb
152
+ - lib/ecommerce/resources/adjustment_order.rb
153
+ - lib/ecommerce/resources/adjustment_order_collection.rb
151
154
  - lib/ecommerce/resources/base.rb
152
155
  - lib/ecommerce/resources/collection.rb
153
156
  - lib/ecommerce/resources/invoice_order.rb
@@ -162,6 +165,7 @@ files:
162
165
  - spec/ecommerce/configuration_spec.rb
163
166
  - spec/ecommerce/request_spec.rb
164
167
  - spec/ecommerce/resources/account_order_spec.rb
168
+ - spec/ecommerce/resources/adjustment_order_spec.rb
165
169
  - spec/ecommerce/resources/collection_spec.rb
166
170
  - spec/ecommerce/resources/invoice_order_collection_spec.rb
167
171
  - spec/ecommerce/resources/invoice_order_spec.rb
@@ -174,6 +178,15 @@ files:
174
178
  - spec/support/vcr.rb
175
179
  - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_not_found_raises_NotFound.yml
176
180
  - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_success_returns_a_find_all_of_orders.yml
181
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_create_when_success_returns_adjustment_created_body.yml
182
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_create_when_success_when_sending_not_all_required_paramete.yml
183
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_destroy_when_not_found_raises_NotFound.yml
184
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_destroy_when_success_returns_empty_body.yml
185
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_not_found_raises_NotFound.yml
186
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_not_found_raises_RequestError.yml
187
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_success_returns_a_find_all_of_orders.yml
188
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_when_not_found_raises_NotFound.yml
189
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_when_success_returns_adjustment_order_object.yml
177
190
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_not_found_raises_NotFound.yml
178
191
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_success_returns_a_find_all_of_orders.yml
179
192
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_not_found_raises_NotFound.yml
@@ -213,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
226
  version: '0'
214
227
  requirements: []
215
228
  rubyforge_project:
216
- rubygems_version: 2.2.2
229
+ rubygems_version: 2.4.5
217
230
  signing_key:
218
231
  specification_version: 4
219
232
  summary: Official Ruby client for Myfreecomm's Ecommerce API.
@@ -223,6 +236,7 @@ test_files:
223
236
  - spec/ecommerce/configuration_spec.rb
224
237
  - spec/ecommerce/request_spec.rb
225
238
  - spec/ecommerce/resources/account_order_spec.rb
239
+ - spec/ecommerce/resources/adjustment_order_spec.rb
226
240
  - spec/ecommerce/resources/collection_spec.rb
227
241
  - spec/ecommerce/resources/invoice_order_collection_spec.rb
228
242
  - spec/ecommerce/resources/invoice_order_spec.rb
@@ -235,6 +249,15 @@ test_files:
235
249
  - spec/support/vcr.rb
236
250
  - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_not_found_raises_NotFound.yml
237
251
  - spec/vcr_cassettes/Ecommerce/Resources_AccountOrder_find_all_when_success_returns_a_find_all_of_orders.yml
252
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_create_when_success_returns_adjustment_created_body.yml
253
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_create_when_success_when_sending_not_all_required_paramete.yml
254
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_destroy_when_not_found_raises_NotFound.yml
255
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_destroy_when_success_returns_empty_body.yml
256
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_not_found_raises_NotFound.yml
257
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_not_found_raises_RequestError.yml
258
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_all_when_success_returns_a_find_all_of_orders.yml
259
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_when_not_found_raises_NotFound.yml
260
+ - spec/vcr_cassettes/Ecommerce/Resources_AdjustmentOrder_find_when_success_returns_adjustment_order_object.yml
238
261
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_not_found_raises_NotFound.yml
239
262
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_all_when_success_returns_a_find_all_of_orders.yml
240
263
  - spec/vcr_cassettes/Ecommerce/Resources_InvoiceOrder_find_when_not_found_raises_NotFound.yml