moysklad 0.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +2 -0
- data/Guardfile +5 -0
- data/Rakefile +6 -0
- data/lib/moysklad/client.rb +1 -1
- data/lib/moysklad/client/errors.rb +6 -4
- data/lib/moysklad/entities.rb +5 -0
- data/lib/moysklad/entities/attribute.rb +27 -2
- data/lib/moysklad/entities/attribute_metadata.rb +27 -0
- data/lib/moysklad/entities/base.rb +10 -0
- data/lib/moysklad/entities/common.rb +0 -1
- data/lib/moysklad/entities/custom_entity.rb +18 -0
- data/lib/moysklad/entities/custom_entity_metadata.rb +35 -0
- data/lib/moysklad/entities/customer_order.rb +4 -0
- data/lib/moysklad/entities/customer_order_position.rb +1 -0
- data/lib/moysklad/entities/embedded_entity_metadata.rb +2 -0
- data/lib/moysklad/entities/feature.rb +2 -3
- data/lib/moysklad/entities/good.rb +12 -9
- data/lib/moysklad/entities/good_folder.rb +9 -0
- data/lib/moysklad/entities/price.rb +1 -1
- data/lib/moysklad/entities/xml_fix.rb +9 -5
- data/lib/moysklad/resources.rb +7 -11
- data/lib/moysklad/resources/base.rb +11 -2
- data/lib/moysklad/resources/custom_entity_metadata.rb +18 -0
- data/lib/moysklad/resources/indexed.rb +56 -46
- data/lib/moysklad/resources/metadata.rb +20 -0
- data/lib/moysklad/resources/metadata_indexed.rb +7 -0
- data/lib/moysklad/resources/subresource.rb +21 -0
- data/lib/moysklad/resources/where_filter.rb +16 -0
- data/lib/moysklad/universe.rb +1 -5
- data/lib/moysklad/version.rb +1 -1
- data/moysklad.gemspec +2 -0
- data/scripts/rest.sh +7 -1
- data/spec/fixtures/302.raw +15 -0
- data/spec/fixtures/400.raw +8 -0
- data/spec/fixtures/CustomEntityMetadata_list.raw +14 -0
- data/spec/fixtures/CustomEntity_list.raw +14 -0
- data/spec/fixtures/Good_e932ebe1-2e22-11e4-9406-002590a28eca.raw +12 -0
- data/spec/fixtures/Good_eb77ad57-2e22-11e4-4030-002590a28eca.raw +12 -0
- data/spec/fixtures/Goods_list.raw +14 -0
- data/spec/fixtures/Metadata_list.raw +14 -0
- data/spec/fixtures/attribute_boolean.xml +6 -0
- data/spec/fixtures/attribute_dictionary.xml +5 -0
- data/spec/fixtures/attribute_double.xml +6 -0
- data/spec/fixtures/attribute_file.xml +12 -0
- data/spec/fixtures/attribute_long.xml +6 -0
- data/spec/fixtures/attribute_text.xml +5 -0
- data/spec/fixtures/attribute_time.xml +6 -0
- data/spec/fixtures/attribute_url.xml +6 -0
- data/spec/fixtures/customer_order.xml +28 -0
- data/spec/fixtures/good_with_attributes.raw +12 -0
- data/spec/lib/moysklad/entities/attribute_metadata_spec.rb +30 -0
- data/spec/lib/moysklad/entities/attribute_spec.rb +36 -0
- data/spec/lib/moysklad/entities/custom_entity_metadata_spec.rb +34 -0
- data/spec/lib/moysklad/entities/custom_entity_spec.rb +35 -0
- data/spec/lib/moysklad/entities/customer_order_position_spec.rb +35 -0
- data/spec/lib/moysklad/entities/customer_order_spec.rb +53 -0
- data/spec/lib/moysklad/entities/good_spec.rb +46 -0
- data/spec/lib/moysklad/resources/base_spec.rb +1 -3
- data/spec/lib/moysklad/resources/custom_entity_metadata_spec.rb +13 -0
- data/spec/lib/moysklad/resources/good_folders_spec.rb +17 -0
- data/spec/lib/moysklad/resources/indexed_spec.rb +31 -3
- data/spec/lib/moysklad/resources/metadata_indexed_spec.rb +20 -0
- data/spec/lib/moysklad/resources/metadata_spec.rb +15 -0
- data/spec/lib/moysklad/resources/subresource_spec.rb +13 -0
- data/spec/lib/moysklad/resources_spec.rb +1 -0
- data/spec/lib/moysklad/universe_spec.rb +1 -0
- data/spec/support/resource.rb +10 -0
- metadata +99 -2
@@ -13,6 +13,7 @@ describe Moysklad::Universe do
|
|
13
13
|
it 'should have a features resoruce' do
|
14
14
|
expect(subject.features).to be_a Moysklad::Resources::Indexed
|
15
15
|
expect(subject.features.resource).to be_a Moysklad::Resources::Features
|
16
|
+
expect(subject.metadata.resource).to be_a Moysklad::Resources::Metadata
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
data/spec/support/resource.rb
CHANGED
@@ -24,10 +24,20 @@ module RspecResourceSupport
|
|
24
24
|
863
|
25
25
|
end
|
26
26
|
|
27
|
+
def stub_rest type, action=:list, start=nil
|
28
|
+
url = "https://online.moysklad.ru/exchange/rest/ms/xml/#{type}/#{action}"
|
29
|
+
url << "?start=#{start}" if start
|
30
|
+
stub_request(:get, url).to_return File.new "./spec/fixtures/#{type}_#{action}.raw"
|
31
|
+
end
|
32
|
+
|
27
33
|
def client
|
28
34
|
@client ||= Moysklad::Client.new
|
29
35
|
end
|
30
36
|
|
37
|
+
def universe
|
38
|
+
@universe ||= Moysklad::Universe.new client: client
|
39
|
+
end
|
40
|
+
|
31
41
|
def resource_list_url res=nil, start=nil
|
32
42
|
res ||= resource
|
33
43
|
url = Moysklad::Client::URL + '/' + res.send(:list_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moysklad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danil Pismenny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-ctags-bundler
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description: Правильный клиент для работы c xml rest API moyslad.ru, созданный по
|
126
154
|
принципам SOLID
|
127
155
|
email:
|
@@ -143,6 +171,7 @@ files:
|
|
143
171
|
- lib/moysklad/client/errors.rb
|
144
172
|
- lib/moysklad/entities.rb
|
145
173
|
- lib/moysklad/entities/attribute.rb
|
174
|
+
- lib/moysklad/entities/attribute_metadata.rb
|
146
175
|
- lib/moysklad/entities/barcode.rb
|
147
176
|
- lib/moysklad/entities/base.rb
|
148
177
|
- lib/moysklad/entities/collection.rb
|
@@ -152,12 +181,15 @@ files:
|
|
152
181
|
- lib/moysklad/entities/company_concern.rb
|
153
182
|
- lib/moysklad/entities/consignment.rb
|
154
183
|
- lib/moysklad/entities/contract.rb
|
184
|
+
- lib/moysklad/entities/custom_entity.rb
|
185
|
+
- lib/moysklad/entities/custom_entity_metadata.rb
|
155
186
|
- lib/moysklad/entities/customer_order.rb
|
156
187
|
- lib/moysklad/entities/customer_order_position.rb
|
157
188
|
- lib/moysklad/entities/embedded_entity_metadata.rb
|
158
189
|
- lib/moysklad/entities/error.rb
|
159
190
|
- lib/moysklad/entities/feature.rb
|
160
191
|
- lib/moysklad/entities/good.rb
|
192
|
+
- lib/moysklad/entities/good_folder.rb
|
161
193
|
- lib/moysklad/entities/good_ref.rb
|
162
194
|
- lib/moysklad/entities/my_company.rb
|
163
195
|
- lib/moysklad/entities/page.rb
|
@@ -170,23 +202,58 @@ files:
|
|
170
202
|
- lib/moysklad/errors.rb
|
171
203
|
- lib/moysklad/resources.rb
|
172
204
|
- lib/moysklad/resources/base.rb
|
205
|
+
- lib/moysklad/resources/custom_entity_metadata.rb
|
173
206
|
- lib/moysklad/resources/indexed.rb
|
207
|
+
- lib/moysklad/resources/metadata.rb
|
208
|
+
- lib/moysklad/resources/metadata_indexed.rb
|
174
209
|
- lib/moysklad/resources/stock.rb
|
210
|
+
- lib/moysklad/resources/subresource.rb
|
211
|
+
- lib/moysklad/resources/where_filter.rb
|
175
212
|
- lib/moysklad/universe.rb
|
176
213
|
- lib/moysklad/version.rb
|
177
214
|
- moysklad.gemspec
|
178
215
|
- scripts/rest.sh
|
216
|
+
- spec/fixtures/302.raw
|
217
|
+
- spec/fixtures/400.raw
|
179
218
|
- spec/fixtures/401.html
|
180
219
|
- spec/fixtures/401_2.html
|
181
220
|
- spec/fixtures/405.raw
|
182
221
|
- spec/fixtures/505.html
|
183
222
|
- spec/fixtures/Consignment_list_0.raw
|
184
223
|
- spec/fixtures/Consignment_list_1000.raw
|
224
|
+
- spec/fixtures/CustomEntityMetadata_list.raw
|
225
|
+
- spec/fixtures/CustomEntity_list.raw
|
185
226
|
- spec/fixtures/Feature_list.raw
|
186
227
|
- spec/fixtures/Feature_list_1000.raw
|
228
|
+
- spec/fixtures/Good_e932ebe1-2e22-11e4-9406-002590a28eca.raw
|
229
|
+
- spec/fixtures/Good_eb77ad57-2e22-11e4-4030-002590a28eca.raw
|
230
|
+
- spec/fixtures/Goods_list.raw
|
231
|
+
- spec/fixtures/Metadata_list.raw
|
232
|
+
- spec/fixtures/attribute_boolean.xml
|
233
|
+
- spec/fixtures/attribute_dictionary.xml
|
234
|
+
- spec/fixtures/attribute_double.xml
|
235
|
+
- spec/fixtures/attribute_file.xml
|
236
|
+
- spec/fixtures/attribute_long.xml
|
237
|
+
- spec/fixtures/attribute_text.xml
|
238
|
+
- spec/fixtures/attribute_time.xml
|
239
|
+
- spec/fixtures/attribute_url.xml
|
240
|
+
- spec/fixtures/customer_order.xml
|
241
|
+
- spec/fixtures/good_with_attributes.raw
|
187
242
|
- spec/lib/moysklad/client/errors_spec.rb
|
243
|
+
- spec/lib/moysklad/entities/attribute_metadata_spec.rb
|
244
|
+
- spec/lib/moysklad/entities/attribute_spec.rb
|
245
|
+
- spec/lib/moysklad/entities/custom_entity_metadata_spec.rb
|
246
|
+
- spec/lib/moysklad/entities/custom_entity_spec.rb
|
247
|
+
- spec/lib/moysklad/entities/customer_order_position_spec.rb
|
248
|
+
- spec/lib/moysklad/entities/customer_order_spec.rb
|
249
|
+
- spec/lib/moysklad/entities/good_spec.rb
|
188
250
|
- spec/lib/moysklad/resources/base_spec.rb
|
251
|
+
- spec/lib/moysklad/resources/custom_entity_metadata_spec.rb
|
252
|
+
- spec/lib/moysklad/resources/good_folders_spec.rb
|
189
253
|
- spec/lib/moysklad/resources/indexed_spec.rb
|
254
|
+
- spec/lib/moysklad/resources/metadata_indexed_spec.rb
|
255
|
+
- spec/lib/moysklad/resources/metadata_spec.rb
|
256
|
+
- spec/lib/moysklad/resources/subresource_spec.rb
|
190
257
|
- spec/lib/moysklad/resources_spec.rb
|
191
258
|
- spec/lib/moysklad/universe_spec.rb
|
192
259
|
- spec/lib/moysklad_spec.rb
|
@@ -217,17 +284,47 @@ signing_key:
|
|
217
284
|
specification_version: 4
|
218
285
|
summary: Клиент для работы с API moysklad.ru
|
219
286
|
test_files:
|
287
|
+
- spec/fixtures/302.raw
|
288
|
+
- spec/fixtures/400.raw
|
220
289
|
- spec/fixtures/401.html
|
221
290
|
- spec/fixtures/401_2.html
|
222
291
|
- spec/fixtures/405.raw
|
223
292
|
- spec/fixtures/505.html
|
224
293
|
- spec/fixtures/Consignment_list_0.raw
|
225
294
|
- spec/fixtures/Consignment_list_1000.raw
|
295
|
+
- spec/fixtures/CustomEntityMetadata_list.raw
|
296
|
+
- spec/fixtures/CustomEntity_list.raw
|
226
297
|
- spec/fixtures/Feature_list.raw
|
227
298
|
- spec/fixtures/Feature_list_1000.raw
|
299
|
+
- spec/fixtures/Good_e932ebe1-2e22-11e4-9406-002590a28eca.raw
|
300
|
+
- spec/fixtures/Good_eb77ad57-2e22-11e4-4030-002590a28eca.raw
|
301
|
+
- spec/fixtures/Goods_list.raw
|
302
|
+
- spec/fixtures/Metadata_list.raw
|
303
|
+
- spec/fixtures/attribute_boolean.xml
|
304
|
+
- spec/fixtures/attribute_dictionary.xml
|
305
|
+
- spec/fixtures/attribute_double.xml
|
306
|
+
- spec/fixtures/attribute_file.xml
|
307
|
+
- spec/fixtures/attribute_long.xml
|
308
|
+
- spec/fixtures/attribute_text.xml
|
309
|
+
- spec/fixtures/attribute_time.xml
|
310
|
+
- spec/fixtures/attribute_url.xml
|
311
|
+
- spec/fixtures/customer_order.xml
|
312
|
+
- spec/fixtures/good_with_attributes.raw
|
228
313
|
- spec/lib/moysklad/client/errors_spec.rb
|
314
|
+
- spec/lib/moysklad/entities/attribute_metadata_spec.rb
|
315
|
+
- spec/lib/moysklad/entities/attribute_spec.rb
|
316
|
+
- spec/lib/moysklad/entities/custom_entity_metadata_spec.rb
|
317
|
+
- spec/lib/moysklad/entities/custom_entity_spec.rb
|
318
|
+
- spec/lib/moysklad/entities/customer_order_position_spec.rb
|
319
|
+
- spec/lib/moysklad/entities/customer_order_spec.rb
|
320
|
+
- spec/lib/moysklad/entities/good_spec.rb
|
229
321
|
- spec/lib/moysklad/resources/base_spec.rb
|
322
|
+
- spec/lib/moysklad/resources/custom_entity_metadata_spec.rb
|
323
|
+
- spec/lib/moysklad/resources/good_folders_spec.rb
|
230
324
|
- spec/lib/moysklad/resources/indexed_spec.rb
|
325
|
+
- spec/lib/moysklad/resources/metadata_indexed_spec.rb
|
326
|
+
- spec/lib/moysklad/resources/metadata_spec.rb
|
327
|
+
- spec/lib/moysklad/resources/subresource_spec.rb
|
231
328
|
- spec/lib/moysklad/resources_spec.rb
|
232
329
|
- spec/lib/moysklad/universe_spec.rb
|
233
330
|
- spec/lib/moysklad_spec.rb
|