ecwid_api 0.0.2 → 0.2.3
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 +5 -5
- data/.travis.yml +8 -0
- data/README.md +123 -31
- data/ecwid_api.gemspec +10 -8
- data/lib/ecwid_api.rb +18 -29
- data/lib/ecwid_api/api.rb +12 -0
- data/lib/ecwid_api/api/base.rb +18 -0
- data/lib/ecwid_api/api/categories.rb +56 -0
- data/lib/ecwid_api/api/customers.rb +53 -0
- data/lib/ecwid_api/api/orders.rb +36 -0
- data/lib/ecwid_api/api/product_combinations.rb +48 -0
- data/lib/ecwid_api/api/product_types.rb +56 -0
- data/lib/ecwid_api/api/products.rb +148 -0
- data/lib/ecwid_api/category.rb +53 -4
- data/lib/ecwid_api/client.rb +65 -58
- data/lib/ecwid_api/customer.rb +10 -0
- data/lib/ecwid_api/entity.rb +151 -29
- data/lib/ecwid_api/error.rb +10 -0
- data/lib/ecwid_api/o_auth.rb +106 -0
- data/lib/ecwid_api/order.rb +118 -0
- data/lib/ecwid_api/order_item.rb +17 -0
- data/lib/ecwid_api/paged_ecwid_response.rb +57 -0
- data/lib/ecwid_api/paged_enumerator.rb +66 -0
- data/lib/ecwid_api/person.rb +7 -0
- data/lib/ecwid_api/product.rb +65 -0
- data/lib/ecwid_api/product_combination.rb +30 -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 +9 -1
- data/spec/api/categories_spec.rb +31 -0
- data/spec/api/customers_spec.rb +20 -0
- data/spec/api/orders_spec.rb +30 -0
- data/spec/api/product_types_spec.rb +20 -0
- data/spec/api/products_spec.rb +20 -0
- data/spec/category_spec.rb +1 -6
- data/spec/client_spec.rb +4 -32
- data/spec/entity_spec.rb +120 -8
- data/spec/fixtures/categories.json +28 -22
- data/spec/fixtures/classes.json +44 -0
- data/spec/fixtures/customers.json +48 -0
- data/spec/fixtures/order.json +162 -0
- data/spec/fixtures/orders.json +303 -0
- data/spec/fixtures/products.json +141 -0
- data/spec/helpers/client.rb +34 -0
- data/spec/oauth_spec.rb +40 -0
- data/spec/order_item_spec.rb +12 -0
- data/spec/order_spec.rb +71 -0
- data/spec/paged_enumerator_spec.rb +38 -0
- data/spec/spec_helper.rb +3 -3
- metadata +93 -37
- data/lib/ecwid_api/category_api.rb +0 -62
- data/spec/category_api_spec.rb +0 -36
- data/spec/ecwid_api_spec.rb +0 -15
- data/spec/helpers/faraday.rb +0 -30
data/spec/oauth_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EcwidApi::OAuth do
|
4
|
+
subject do
|
5
|
+
EcwidApi::OAuth.new do |config|
|
6
|
+
config.client_id = "client_id"
|
7
|
+
config.client_secret = "client_secret"
|
8
|
+
config.scope = "scope"
|
9
|
+
config.redirect_uri = "https://example.com/oauth"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
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
|
+
|
15
|
+
describe "#access_token(code)" do
|
16
|
+
let(:response) do
|
17
|
+
double("response").tap do |response|
|
18
|
+
allow(response).to receive(:success?).and_return(true)
|
19
|
+
allow(response).to receive(:body).and_return(access_token: "the_token", store_id: "12345")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
allow(subject.send(:connection)).to receive(:post).with("/api/oauth/token", hash_including(code: "code")).and_return(response)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "sends a request to the API for an access_token" do
|
28
|
+
expect(subject.send(:connection)).to receive(:post).with("/api/oauth/token", hash_including(code: "code")).and_return(response)
|
29
|
+
subject.access_token("code")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns an object that has the access_token" do
|
33
|
+
expect(subject.access_token("code").access_token).to eq "the_token"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns an object that has the store_id" do
|
37
|
+
expect(subject.access_token("code").store_id).to eq "12345"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EcwidApi::OrderItem do
|
4
|
+
subject { EcwidApi::OrderItem.new({"sku" => "12345", "categoryId" => 222}, client: client) }
|
5
|
+
|
6
|
+
describe "#category" do
|
7
|
+
it "gets the category from the client" do
|
8
|
+
expect(client.categories).to receive(:find).with(222)
|
9
|
+
subject.category
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/spec/order_spec.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EcwidApi::Order, faraday: true do
|
4
|
+
subject do
|
5
|
+
EcwidApi::Order.new({
|
6
|
+
"id" => 123,
|
7
|
+
"billingPerson" => {
|
8
|
+
"name" => "John Doe"
|
9
|
+
},
|
10
|
+
"shippingPerson" => shipping_person,
|
11
|
+
"items" => [{
|
12
|
+
"sku" => "112233"
|
13
|
+
}],
|
14
|
+
"fulfillmentStatus" => "AWAITING_PROCESSING"
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:shipping_person) { nil }
|
19
|
+
|
20
|
+
it { is_expected.to have_attributes(id: 123) }
|
21
|
+
|
22
|
+
describe "#billing_person" do
|
23
|
+
it { expect(subject.billing_person).to be_a(EcwidApi::Person) }
|
24
|
+
|
25
|
+
it "has the correct data" do
|
26
|
+
expect(subject.billing_person.name).to eq "John Doe"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#shipping_person" do
|
31
|
+
it { expect(subject.shipping_person).to be_a(EcwidApi::Person) }
|
32
|
+
|
33
|
+
context "without a shipping person" do
|
34
|
+
let(:shipping_person) { nil }
|
35
|
+
it { expect(subject.shipping_person).to be(subject.billing_person) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with a shipping person" do
|
39
|
+
let(:shipping_person) { {"name" => "Jane Doe"} }
|
40
|
+
it "has the correct data" do
|
41
|
+
expect(subject.shipping_person.name).to eq "Jane Doe"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#items" do
|
47
|
+
it "has the correct number of items" do
|
48
|
+
expect(subject.items.size).to eq 1
|
49
|
+
end
|
50
|
+
|
51
|
+
it "has the correct data" do
|
52
|
+
expect(subject.items.first.sku).to eq "112233"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#fulfillment_status=" do
|
57
|
+
it "raises an error with an invalid status" do
|
58
|
+
expect { subject.fulfillment_status = :stuff }.to raise_error(StandardError)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "doesn't raise an error with a valid status" do
|
62
|
+
expect { subject.fulfillment_status = :processing }.to_not raise_error
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "#fulfillment_status" do
|
67
|
+
it "is symbolized" do
|
68
|
+
expect(subject.fulfillment_status).to eq :awaiting_processing
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EcwidApi::PagedEnumerator do
|
4
|
+
subject do
|
5
|
+
EcwidApi::PagedEnumerator.new(response_one, &proc)
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:proc) do
|
9
|
+
Proc.new do |response, yielder|
|
10
|
+
response[:stuff].each { |thing| yielder << thing }
|
11
|
+
response[:next]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:response_one) do
|
16
|
+
{
|
17
|
+
stuff: %w(1 2 3),
|
18
|
+
next: response_two
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:response_two) do
|
23
|
+
{
|
24
|
+
stuff: %w(4 5 6),
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
it "contains the whole result set" do
|
29
|
+
expect(subject.to_a).to eq %w(1 2 3 4 5 6)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "iterates over each response once" do
|
33
|
+
expect(response_two[:stuff]).to receive(:each).once.and_call_original
|
34
|
+
|
35
|
+
subject.each
|
36
|
+
subject.each
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,14 +6,14 @@
|
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
|
8
8
|
require "ecwid_api"
|
9
|
-
require "helpers/
|
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
|
|
16
|
-
config.include Helpers::
|
16
|
+
config.include Helpers::Client
|
17
17
|
|
18
18
|
# Run specs in random order to surface order dependencies. If you find an
|
19
19
|
# order dependency and want to debug it, you can fix the order by providing
|
metadata
CHANGED
@@ -1,147 +1,203 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecwid_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
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
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.5'
|
21
|
+
- - ">="
|
18
22
|
- !ruby/object:Gem::Version
|
19
23
|
version: '1.5'
|
20
24
|
type: :development
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
|
-
- - ~>
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.5'
|
31
|
+
- - ">="
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '1.5'
|
27
34
|
- !ruby/object:Gem::Dependency
|
28
35
|
name: rake
|
29
36
|
requirement: !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
|
-
- -
|
38
|
+
- - "~>"
|
32
39
|
- !ruby/object:Gem::Version
|
33
40
|
version: '0'
|
34
41
|
type: :development
|
35
42
|
prerelease: false
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - "~>"
|
39
46
|
- !ruby/object:Gem::Version
|
40
47
|
version: '0'
|
41
48
|
- !ruby/object:Gem::Dependency
|
42
49
|
name: rspec
|
43
50
|
requirement: !ruby/object:Gem::Requirement
|
44
51
|
requirements:
|
45
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- - ">="
|
46
56
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
57
|
+
version: '3.5'
|
48
58
|
type: :development
|
49
59
|
prerelease: false
|
50
60
|
version_requirements: !ruby/object:Gem::Requirement
|
51
61
|
requirements:
|
52
|
-
- - ~>
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '3.5'
|
65
|
+
- - ">="
|
53
66
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
67
|
+
version: '3.5'
|
55
68
|
- !ruby/object:Gem::Dependency
|
56
69
|
name: faraday
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
58
71
|
requirements:
|
59
|
-
- - ~>
|
72
|
+
- - "~>"
|
60
73
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.9
|
74
|
+
version: '0.9'
|
62
75
|
type: :runtime
|
63
76
|
prerelease: false
|
64
77
|
version_requirements: !ruby/object:Gem::Requirement
|
65
78
|
requirements:
|
66
|
-
- - ~>
|
79
|
+
- - "~>"
|
67
80
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.9
|
81
|
+
version: '0.9'
|
69
82
|
- !ruby/object:Gem::Dependency
|
70
83
|
name: faraday_middleware
|
71
84
|
requirement: !ruby/object:Gem::Requirement
|
72
85
|
requirements:
|
73
|
-
- - ~>
|
86
|
+
- - "~>"
|
74
87
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.9
|
88
|
+
version: '0.9'
|
76
89
|
type: :runtime
|
77
90
|
prerelease: false
|
78
91
|
version_requirements: !ruby/object:Gem::Requirement
|
79
92
|
requirements:
|
80
|
-
- - ~>
|
93
|
+
- - "~>"
|
81
94
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9
|
83
|
-
description:
|
95
|
+
version: '0.9'
|
96
|
+
description: A client for the Ecwid REST API in Ruby
|
84
97
|
email:
|
85
|
-
-
|
98
|
+
- v.zambre@gmail.com
|
86
99
|
executables: []
|
87
100
|
extensions: []
|
88
101
|
extra_rdoc_files: []
|
89
102
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
103
|
+
- ".gitignore"
|
104
|
+
- ".rspec"
|
105
|
+
- ".travis.yml"
|
92
106
|
- Gemfile
|
93
107
|
- LICENSE.txt
|
94
108
|
- README.md
|
95
109
|
- Rakefile
|
96
110
|
- ecwid_api.gemspec
|
97
111
|
- lib/ecwid_api.rb
|
112
|
+
- lib/ecwid_api/api.rb
|
113
|
+
- lib/ecwid_api/api/base.rb
|
114
|
+
- lib/ecwid_api/api/categories.rb
|
115
|
+
- lib/ecwid_api/api/customers.rb
|
116
|
+
- lib/ecwid_api/api/orders.rb
|
117
|
+
- lib/ecwid_api/api/product_combinations.rb
|
118
|
+
- lib/ecwid_api/api/product_types.rb
|
119
|
+
- lib/ecwid_api/api/products.rb
|
98
120
|
- lib/ecwid_api/category.rb
|
99
|
-
- lib/ecwid_api/category_api.rb
|
100
121
|
- lib/ecwid_api/client.rb
|
122
|
+
- lib/ecwid_api/customer.rb
|
101
123
|
- lib/ecwid_api/entity.rb
|
102
124
|
- lib/ecwid_api/error.rb
|
125
|
+
- lib/ecwid_api/o_auth.rb
|
126
|
+
- lib/ecwid_api/order.rb
|
127
|
+
- lib/ecwid_api/order_item.rb
|
128
|
+
- lib/ecwid_api/paged_ecwid_response.rb
|
129
|
+
- lib/ecwid_api/paged_enumerator.rb
|
130
|
+
- lib/ecwid_api/person.rb
|
131
|
+
- lib/ecwid_api/product.rb
|
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
|
103
136
|
- lib/ecwid_api/version.rb
|
104
137
|
- lib/ext/string.rb
|
105
|
-
- spec/
|
138
|
+
- spec/api/categories_spec.rb
|
139
|
+
- spec/api/customers_spec.rb
|
140
|
+
- spec/api/orders_spec.rb
|
141
|
+
- spec/api/product_types_spec.rb
|
142
|
+
- spec/api/products_spec.rb
|
106
143
|
- spec/category_spec.rb
|
107
144
|
- spec/client_spec.rb
|
108
|
-
- spec/ecwid_api_spec.rb
|
109
145
|
- spec/entity_spec.rb
|
110
146
|
- spec/fixtures/categories.json
|
111
147
|
- spec/fixtures/category.json
|
112
|
-
- spec/
|
148
|
+
- spec/fixtures/classes.json
|
149
|
+
- spec/fixtures/customers.json
|
150
|
+
- spec/fixtures/order.json
|
151
|
+
- spec/fixtures/orders.json
|
152
|
+
- spec/fixtures/products.json
|
153
|
+
- spec/helpers/client.rb
|
154
|
+
- spec/oauth_spec.rb
|
155
|
+
- spec/order_item_spec.rb
|
156
|
+
- spec/order_spec.rb
|
157
|
+
- spec/paged_enumerator_spec.rb
|
113
158
|
- spec/spec_helper.rb
|
114
|
-
homepage:
|
159
|
+
homepage: https://github.com/vishalzambre/ecwid_api
|
115
160
|
licenses:
|
116
161
|
- MIT
|
117
162
|
metadata: {}
|
118
|
-
post_install_message:
|
163
|
+
post_install_message: Thanks for installing!
|
119
164
|
rdoc_options: []
|
120
165
|
require_paths:
|
121
166
|
- lib
|
122
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
168
|
requirements:
|
124
|
-
- -
|
169
|
+
- - ">="
|
125
170
|
- !ruby/object:Gem::Version
|
126
171
|
version: '0'
|
127
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
173
|
requirements:
|
129
|
-
- -
|
174
|
+
- - ">="
|
130
175
|
- !ruby/object:Gem::Version
|
131
176
|
version: '0'
|
132
177
|
requirements: []
|
133
|
-
|
134
|
-
|
135
|
-
signing_key:
|
178
|
+
rubygems_version: 3.1.2
|
179
|
+
signing_key:
|
136
180
|
specification_version: 4
|
137
181
|
summary: A client for the Ecwid REST API
|
138
182
|
test_files:
|
139
|
-
- spec/
|
183
|
+
- spec/api/categories_spec.rb
|
184
|
+
- spec/api/customers_spec.rb
|
185
|
+
- spec/api/orders_spec.rb
|
186
|
+
- spec/api/product_types_spec.rb
|
187
|
+
- spec/api/products_spec.rb
|
140
188
|
- spec/category_spec.rb
|
141
189
|
- spec/client_spec.rb
|
142
|
-
- spec/ecwid_api_spec.rb
|
143
190
|
- spec/entity_spec.rb
|
144
191
|
- spec/fixtures/categories.json
|
145
192
|
- spec/fixtures/category.json
|
146
|
-
- spec/
|
193
|
+
- spec/fixtures/classes.json
|
194
|
+
- spec/fixtures/customers.json
|
195
|
+
- spec/fixtures/order.json
|
196
|
+
- spec/fixtures/orders.json
|
197
|
+
- spec/fixtures/products.json
|
198
|
+
- spec/helpers/client.rb
|
199
|
+
- spec/oauth_spec.rb
|
200
|
+
- spec/order_item_spec.rb
|
201
|
+
- spec/order_spec.rb
|
202
|
+
- spec/paged_enumerator_spec.rb
|
147
203
|
- spec/spec_helper.rb
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module EcwidApi
|
2
|
-
# Public: This is the Ecwid API for Categories. It abstracts the end-points
|
3
|
-
# of the Ecwid API that deal with categories.
|
4
|
-
class CategoryApi
|
5
|
-
# Private: Gets the Client
|
6
|
-
attr_reader :client
|
7
|
-
private :client
|
8
|
-
|
9
|
-
# Public: Initializes a new EcwidApi::CategoryApi
|
10
|
-
#
|
11
|
-
# client - The EcwidApi::Client to use with the API
|
12
|
-
#
|
13
|
-
def initialize(client = EcwidApi.default_client)
|
14
|
-
@client = client
|
15
|
-
raise Error.new("The client cannot be nil") unless client
|
16
|
-
end
|
17
|
-
|
18
|
-
# Public: Returns all of the sub-categories for a given category
|
19
|
-
#
|
20
|
-
# See: http://kb.ecwid.com/w/page/25285101/Product%20API#RESTAPIMethodcategories
|
21
|
-
#
|
22
|
-
# parent - The Category ID of the parent category. If the parent is 0 then
|
23
|
-
# a list of the root categories will be returned. If the parent is
|
24
|
-
# nil, then all of the categories will be returned
|
25
|
-
#
|
26
|
-
# Returns an array of EcwidApi::Category objects
|
27
|
-
def all(parent = nil)
|
28
|
-
params = {}
|
29
|
-
params[:parent] = parent if parent
|
30
|
-
|
31
|
-
response = client.get("categories", params)
|
32
|
-
|
33
|
-
if response.success?
|
34
|
-
response.body
|
35
|
-
else
|
36
|
-
[]
|
37
|
-
end.map {|category| Category.new(category, client: client) }
|
38
|
-
end
|
39
|
-
|
40
|
-
# Public: Returns an Array of the root level EcwidApi::Category objects
|
41
|
-
def root
|
42
|
-
all(0)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Public: Returns a single EcwidApi::Category
|
46
|
-
#
|
47
|
-
# See: http://kb.ecwid.com/w/page/25285101/Product%20API#RESTAPIMethodcategory
|
48
|
-
#
|
49
|
-
# category_id - A Category ID to get
|
50
|
-
#
|
51
|
-
# Returns an EcwidApi::Category, or nil if it can't be found
|
52
|
-
def find(category_id)
|
53
|
-
response = client.get("category", id: category_id)
|
54
|
-
|
55
|
-
if response.success?
|
56
|
-
Category.new(response.body, client: client)
|
57
|
-
else
|
58
|
-
nil
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|