ecwid_api 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +12 -4
- data/Rakefile +0 -0
- data/ecwid_api.gemspec +8 -7
- data/lib/ecwid_api.rb +3 -0
- data/lib/ecwid_api/api.rb +6 -3
- data/lib/ecwid_api/api/base.rb +0 -0
- data/lib/ecwid_api/api/categories.rb +0 -0
- data/lib/ecwid_api/api/customers.rb +53 -0
- data/lib/ecwid_api/api/orders.rb +4 -4
- data/lib/ecwid_api/api/product_combinations.rb +0 -0
- data/lib/ecwid_api/api/product_types.rb +56 -0
- data/lib/ecwid_api/api/products.rb +93 -7
- data/lib/ecwid_api/category.rb +0 -0
- data/lib/ecwid_api/client.rb +7 -5
- data/lib/ecwid_api/customer.rb +10 -0
- data/lib/ecwid_api/entity.rb +15 -3
- data/lib/ecwid_api/error.rb +1 -1
- data/lib/ecwid_api/o_auth.rb +0 -0
- data/lib/ecwid_api/order.rb +39 -9
- data/lib/ecwid_api/order_item.rb +0 -0
- data/lib/ecwid_api/paged_ecwid_response.rb +11 -9
- data/lib/ecwid_api/paged_enumerator.rb +0 -0
- data/lib/ecwid_api/person.rb +0 -0
- data/lib/ecwid_api/product.rb +0 -0
- data/lib/ecwid_api/product_combination.rb +0 -0
- data/lib/ecwid_api/product_type.rb +18 -0
- data/lib/ecwid_api/product_type_attribute.rb +27 -0
- data/lib/ecwid_api/unpaged_ecwid_response.rb +38 -0
- data/lib/ecwid_api/version.rb +1 -1
- data/lib/ext/string.rb +0 -0
- data/spec/api/categories_spec.rb +0 -0
- data/spec/api/customers_spec.rb +20 -0
- data/spec/api/orders_spec.rb +5 -5
- data/spec/api/product_types_spec.rb +20 -0
- data/spec/api/products_spec.rb +0 -0
- data/spec/category_spec.rb +0 -0
- data/spec/client_spec.rb +3 -3
- data/spec/entity_spec.rb +41 -14
- data/spec/fixtures/categories.json +0 -0
- data/spec/fixtures/category.json +0 -0
- data/spec/fixtures/classes.json +44 -0
- data/spec/fixtures/customers.json +48 -0
- data/spec/fixtures/order.json +1 -1
- data/spec/fixtures/orders.json +2 -1
- data/spec/fixtures/products.json +0 -0
- data/spec/helpers/client.rb +4 -2
- data/spec/oauth_spec.rb +4 -4
- data/spec/order_item_spec.rb +0 -0
- data/spec/order_spec.rb +12 -12
- data/spec/paged_enumerator_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +37 -17
File without changes
|
data/spec/fixtures/category.json
CHANGED
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"name": "Foo",
|
5
|
+
"googleTaxonomy": "This > That > Other > Foos",
|
6
|
+
"attributes": [{
|
7
|
+
"id": 111,
|
8
|
+
"name": "UPC",
|
9
|
+
"type": "UPC",
|
10
|
+
"show": "DESCR"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"id": 222,
|
14
|
+
"name": "Brand",
|
15
|
+
"type": "BRAND",
|
16
|
+
"show": "DESCR"
|
17
|
+
}
|
18
|
+
]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"id": 2,
|
22
|
+
"name": "Bar",
|
23
|
+
"googleTaxonomy": "This > That > Other > Bars",
|
24
|
+
"attributes": [{
|
25
|
+
"id": 333,
|
26
|
+
"name": "UPC",
|
27
|
+
"type": "UPC",
|
28
|
+
"show": "DESCR"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": 444,
|
32
|
+
"name": "Brand",
|
33
|
+
"type": "BRAND",
|
34
|
+
"show": "DESCR"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"id": 555,
|
38
|
+
"name": "Blah",
|
39
|
+
"type": "BRAND",
|
40
|
+
"show": "NOTSHOW"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
]
|
@@ -0,0 +1,48 @@
|
|
1
|
+
{
|
2
|
+
"total": 5,
|
3
|
+
"count": 5,
|
4
|
+
"offset": 0,
|
5
|
+
"limit": 100,
|
6
|
+
"items": [
|
7
|
+
{
|
8
|
+
"id": 1,
|
9
|
+
"name": "Abe Doe",
|
10
|
+
"email": "abe@example.com",
|
11
|
+
"totalOrderCount": 1,
|
12
|
+
"customerGroupId": 0,
|
13
|
+
"customerGroupName": "General"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": 2,
|
17
|
+
"name": "Bob Doe",
|
18
|
+
"email": "bob@example.com",
|
19
|
+
"totalOrderCount": 2,
|
20
|
+
"customerGroupId": 0,
|
21
|
+
"customerGroupName": "General"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"id": 3,
|
25
|
+
"name": "Chris Doe",
|
26
|
+
"email": "chris@example.com",
|
27
|
+
"totalOrderCount": 3,
|
28
|
+
"customerGroupId": 0,
|
29
|
+
"customerGroupName": "General"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"id": 4,
|
33
|
+
"name": "Debby Doe",
|
34
|
+
"email": "debby@example.com",
|
35
|
+
"totalOrderCount": 0,
|
36
|
+
"customerGroupId": 0,
|
37
|
+
"customerGroupName": "General"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"id": 5,
|
41
|
+
"name": "Ellen Doe",
|
42
|
+
"email": "ellen@example.com",
|
43
|
+
"totalOrderCount": 0,
|
44
|
+
"customerGroupId": 0,
|
45
|
+
"customerGroupName": "General"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
data/spec/fixtures/order.json
CHANGED
data/spec/fixtures/orders.json
CHANGED
data/spec/fixtures/products.json
CHANGED
File without changes
|
data/spec/helpers/client.rb
CHANGED
@@ -7,7 +7,7 @@ module Helpers
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def fixtures
|
10
|
-
%w(categories category orders products)
|
10
|
+
%w(categories category customers orders products classes)
|
11
11
|
end
|
12
12
|
|
13
13
|
def faraday_stubs
|
@@ -18,6 +18,8 @@ module Helpers
|
|
18
18
|
stub.get("/categories/5") { [200, {"Content-Type" => "application/json"}, File.read("spec/fixtures/category.json") ] }
|
19
19
|
stub.get("/orders/35") { [200, {"Content-Type" => "application/json"}, File.read("spec/fixtures/order.json") ] }
|
20
20
|
stub.get("/orders/404") { [404, {"Content-Type" => "application/json"}, nil ] }
|
21
|
+
stub.get("/classes/1") { [200, {"Content-Type" => "application/json"}, File.read("spec/fixtures/classes.json") ] }
|
22
|
+
stub.get("/classes/404") { [404, {"Content-Type" => "application/json"}, nil ] }
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
@@ -29,4 +31,4 @@ module Helpers
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
32
|
-
end
|
34
|
+
end
|
data/spec/oauth_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe EcwidApi::OAuth do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it { is_expected.to have_attributes(oauth_url: "https://my.ecwid.com/api/oauth/authorize?client_id=client_id&scope=scope&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Foauth") }
|
14
14
|
|
15
15
|
describe "#access_token(code)" do
|
16
16
|
let(:response) do
|
@@ -30,11 +30,11 @@ describe EcwidApi::OAuth do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "returns an object that has the access_token" do
|
33
|
-
|
33
|
+
expect(subject.access_token("code").access_token).to eq "the_token"
|
34
34
|
end
|
35
35
|
|
36
36
|
it "returns an object that has the store_id" do
|
37
|
-
subject.access_token("code").store_id.
|
37
|
+
expect(subject.access_token("code").store_id).to eq "12345"
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
data/spec/order_item_spec.rb
CHANGED
File without changes
|
data/spec/order_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe EcwidApi::Order, faraday: true do
|
4
4
|
subject do
|
5
5
|
EcwidApi::Order.new({
|
6
|
-
"
|
6
|
+
"id" => 123,
|
7
7
|
"billingPerson" => {
|
8
8
|
"name" => "John Doe"
|
9
9
|
},
|
@@ -17,45 +17,45 @@ describe EcwidApi::Order, faraday: true do
|
|
17
17
|
|
18
18
|
let(:shipping_person) { nil }
|
19
19
|
|
20
|
-
|
20
|
+
it { is_expected.to have_attributes(id: 123) }
|
21
21
|
|
22
22
|
describe "#billing_person" do
|
23
|
-
|
23
|
+
it { expect(subject.billing_person).to be_a(EcwidApi::Person) }
|
24
24
|
|
25
25
|
it "has the correct data" do
|
26
|
-
subject.billing_person.name.
|
26
|
+
expect(subject.billing_person.name).to eq "John Doe"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#shipping_person" do
|
31
|
-
|
31
|
+
it { expect(subject.shipping_person).to be_a(EcwidApi::Person) }
|
32
32
|
|
33
33
|
context "without a shipping person" do
|
34
34
|
let(:shipping_person) { nil }
|
35
|
-
|
35
|
+
it { expect(subject.shipping_person).to be(subject.billing_person) }
|
36
36
|
end
|
37
37
|
|
38
38
|
context "with a shipping person" do
|
39
39
|
let(:shipping_person) { {"name" => "Jane Doe"} }
|
40
40
|
it "has the correct data" do
|
41
|
-
subject.shipping_person.name.
|
41
|
+
expect(subject.shipping_person.name).to eq "Jane Doe"
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "#items" do
|
47
47
|
it "has the correct number of items" do
|
48
|
-
subject.items.size.
|
48
|
+
expect(subject.items.size).to eq 1
|
49
49
|
end
|
50
50
|
|
51
51
|
it "has the correct data" do
|
52
|
-
subject.items.first.sku.
|
52
|
+
expect(subject.items.first.sku).to eq "112233"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe "#fulfillment_status=" do
|
57
57
|
it "raises an error with an invalid status" do
|
58
|
-
expect { subject.fulfillment_status = :stuff }.to raise_error
|
58
|
+
expect { subject.fulfillment_status = :stuff }.to raise_error(StandardError)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "doesn't raise an error with a valid status" do
|
@@ -65,7 +65,7 @@ describe EcwidApi::Order, faraday: true do
|
|
65
65
|
|
66
66
|
describe "#fulfillment_status" do
|
67
67
|
it "is symbolized" do
|
68
|
-
subject.fulfillment_status.
|
68
|
+
expect(subject.fulfillment_status).to eq :awaiting_processing
|
69
69
|
end
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
@@ -26,7 +26,7 @@ describe EcwidApi::PagedEnumerator do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "contains the whole result set" do
|
29
|
-
subject.to_a.
|
29
|
+
expect(subject.to_a).to eq %w(1 2 3 4 5 6)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "iterates over each response once" do
|
@@ -35,4 +35,4 @@ describe EcwidApi::PagedEnumerator do
|
|
35
35
|
subject.each
|
36
36
|
subject.each
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ require "ecwid_api"
|
|
9
9
|
require "helpers/client"
|
10
10
|
|
11
11
|
RSpec.configure do |config|
|
12
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
# config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
13
|
config.run_all_when_everything_filtered = true
|
14
14
|
config.filter_run :focus
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecwid_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Biehl
|
8
|
-
|
8
|
+
- Vishal Zambre
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -17,6 +18,9 @@ dependencies:
|
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: '1.5'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '1.5'
|
20
24
|
type: :development
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +28,9 @@ dependencies:
|
|
24
28
|
- - "~>"
|
25
29
|
- !ruby/object:Gem::Version
|
26
30
|
version: '1.5'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
27
34
|
- !ruby/object:Gem::Dependency
|
28
35
|
name: rake
|
29
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,51 +51,51 @@ dependencies:
|
|
44
51
|
requirements:
|
45
52
|
- - "~>"
|
46
53
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
54
|
+
version: '3.5'
|
48
55
|
- - ">="
|
49
56
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
57
|
+
version: '3.5'
|
51
58
|
type: :development
|
52
59
|
prerelease: false
|
53
60
|
version_requirements: !ruby/object:Gem::Requirement
|
54
61
|
requirements:
|
55
62
|
- - "~>"
|
56
63
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
64
|
+
version: '3.5'
|
58
65
|
- - ">="
|
59
66
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
67
|
+
version: '3.5'
|
61
68
|
- !ruby/object:Gem::Dependency
|
62
69
|
name: faraday
|
63
70
|
requirement: !ruby/object:Gem::Requirement
|
64
71
|
requirements:
|
65
72
|
- - "~>"
|
66
73
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.9
|
74
|
+
version: '0.9'
|
68
75
|
type: :runtime
|
69
76
|
prerelease: false
|
70
77
|
version_requirements: !ruby/object:Gem::Requirement
|
71
78
|
requirements:
|
72
79
|
- - "~>"
|
73
80
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.9
|
81
|
+
version: '0.9'
|
75
82
|
- !ruby/object:Gem::Dependency
|
76
83
|
name: faraday_middleware
|
77
84
|
requirement: !ruby/object:Gem::Requirement
|
78
85
|
requirements:
|
79
86
|
- - "~>"
|
80
87
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.9
|
88
|
+
version: '0.9'
|
82
89
|
type: :runtime
|
83
90
|
prerelease: false
|
84
91
|
version_requirements: !ruby/object:Gem::Requirement
|
85
92
|
requirements:
|
86
93
|
- - "~>"
|
87
94
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.9
|
95
|
+
version: '0.9'
|
89
96
|
description: A client for the Ecwid REST API in Ruby
|
90
97
|
email:
|
91
|
-
-
|
98
|
+
- v.zambre@gmail.com
|
92
99
|
executables: []
|
93
100
|
extensions: []
|
94
101
|
extra_rdoc_files: []
|
@@ -105,11 +112,14 @@ files:
|
|
105
112
|
- lib/ecwid_api/api.rb
|
106
113
|
- lib/ecwid_api/api/base.rb
|
107
114
|
- lib/ecwid_api/api/categories.rb
|
115
|
+
- lib/ecwid_api/api/customers.rb
|
108
116
|
- lib/ecwid_api/api/orders.rb
|
109
117
|
- lib/ecwid_api/api/product_combinations.rb
|
118
|
+
- lib/ecwid_api/api/product_types.rb
|
110
119
|
- lib/ecwid_api/api/products.rb
|
111
120
|
- lib/ecwid_api/category.rb
|
112
121
|
- lib/ecwid_api/client.rb
|
122
|
+
- lib/ecwid_api/customer.rb
|
113
123
|
- lib/ecwid_api/entity.rb
|
114
124
|
- lib/ecwid_api/error.rb
|
115
125
|
- lib/ecwid_api/o_auth.rb
|
@@ -120,16 +130,23 @@ files:
|
|
120
130
|
- lib/ecwid_api/person.rb
|
121
131
|
- lib/ecwid_api/product.rb
|
122
132
|
- lib/ecwid_api/product_combination.rb
|
133
|
+
- lib/ecwid_api/product_type.rb
|
134
|
+
- lib/ecwid_api/product_type_attribute.rb
|
135
|
+
- lib/ecwid_api/unpaged_ecwid_response.rb
|
123
136
|
- lib/ecwid_api/version.rb
|
124
137
|
- lib/ext/string.rb
|
125
138
|
- spec/api/categories_spec.rb
|
139
|
+
- spec/api/customers_spec.rb
|
126
140
|
- spec/api/orders_spec.rb
|
141
|
+
- spec/api/product_types_spec.rb
|
127
142
|
- spec/api/products_spec.rb
|
128
143
|
- spec/category_spec.rb
|
129
144
|
- spec/client_spec.rb
|
130
145
|
- spec/entity_spec.rb
|
131
146
|
- spec/fixtures/categories.json
|
132
147
|
- spec/fixtures/category.json
|
148
|
+
- spec/fixtures/classes.json
|
149
|
+
- spec/fixtures/customers.json
|
133
150
|
- spec/fixtures/order.json
|
134
151
|
- spec/fixtures/orders.json
|
135
152
|
- spec/fixtures/products.json
|
@@ -139,11 +156,11 @@ files:
|
|
139
156
|
- spec/order_spec.rb
|
140
157
|
- spec/paged_enumerator_spec.rb
|
141
158
|
- spec/spec_helper.rb
|
142
|
-
homepage: https://github.com/
|
159
|
+
homepage: https://github.com/vishalzambre/ecwid_api
|
143
160
|
licenses:
|
144
161
|
- MIT
|
145
162
|
metadata: {}
|
146
|
-
post_install_message:
|
163
|
+
post_install_message: Thanks for installing!
|
147
164
|
rdoc_options: []
|
148
165
|
require_paths:
|
149
166
|
- lib
|
@@ -158,20 +175,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
175
|
- !ruby/object:Gem::Version
|
159
176
|
version: '0'
|
160
177
|
requirements: []
|
161
|
-
|
162
|
-
|
163
|
-
signing_key:
|
178
|
+
rubygems_version: 3.1.2
|
179
|
+
signing_key:
|
164
180
|
specification_version: 4
|
165
181
|
summary: A client for the Ecwid REST API
|
166
182
|
test_files:
|
167
183
|
- spec/api/categories_spec.rb
|
184
|
+
- spec/api/customers_spec.rb
|
168
185
|
- spec/api/orders_spec.rb
|
186
|
+
- spec/api/product_types_spec.rb
|
169
187
|
- spec/api/products_spec.rb
|
170
188
|
- spec/category_spec.rb
|
171
189
|
- spec/client_spec.rb
|
172
190
|
- spec/entity_spec.rb
|
173
191
|
- spec/fixtures/categories.json
|
174
192
|
- spec/fixtures/category.json
|
193
|
+
- spec/fixtures/classes.json
|
194
|
+
- spec/fixtures/customers.json
|
175
195
|
- spec/fixtures/order.json
|
176
196
|
- spec/fixtures/orders.json
|
177
197
|
- spec/fixtures/products.json
|