moy_sklad 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/xml/Warehouse.xml +77 -0
- data/lib/moy_sklad/client/base.rb +7 -28
- data/lib/moy_sklad/client/formatter.rb +6 -8
- data/lib/moy_sklad/configuration.rb +10 -0
- data/lib/moy_sklad/model/stock_to.rb +19 -0
- data/lib/moy_sklad/model/templates/warehouse.builder +55 -0
- data/lib/moy_sklad/model/warehouse.rb +12 -0
- data/lib/moy_sklad/model.rb +2 -0
- data/lib/moy_sklad/version.rb +1 -1
- data/moy_sklad.gemspec +2 -2
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bea98a2a15e907079eeef4685886547e271f80
|
4
|
+
data.tar.gz: a2ea0a641c66033b331b54cf84cf696045186dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e7d05bf4c28aeefef715fbe5beb06c19dc0034224692f01dc98e20f85a201d93c64305087bdd7eeef6ddf2db41ee935dba91a325e62aea0c8e66b56137252df
|
7
|
+
data.tar.gz: b5cea0e9e3e913cd8382e8264d8d2415708aea17e46b5239e5206ef41f702c705afae8a731182c20bea53f69201c90464657ed25b7534563a36eaeb76cccc5e2
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<warehouse readMode="NONE" changeMode="NEIGHBOUR" updated="2013-11-23T15:44:07" updatedBy="string" name="string" agentUuid="string" archived="true" parentUuid="string">
|
3
|
+
<!--Optional:-->
|
4
|
+
<accountUuid>string</accountUuid>
|
5
|
+
<!--Optional:-->
|
6
|
+
<accountId>string</accountId>
|
7
|
+
<!--Optional:-->
|
8
|
+
<uuid>string</uuid>
|
9
|
+
<!--Optional:-->
|
10
|
+
<groupUuid>string</groupUuid>
|
11
|
+
<!--Optional:-->
|
12
|
+
<deleted>2006-08-19T19:27:14+02:00</deleted>
|
13
|
+
<!--Optional:-->
|
14
|
+
<code>string</code>
|
15
|
+
<!--Optional:-->
|
16
|
+
<externalcode>string</externalcode>
|
17
|
+
<!--Optional:-->
|
18
|
+
<description>string</description>
|
19
|
+
<!--Zero or more repetitions:-->
|
20
|
+
<attribute readMode="NEIGHBOUR" changeMode="ALL" updated="2017-05-15T08:41:13" updatedBy="string" metadataUuid="string" valueText="string" valueString="string" doubleValue="1.051732E7" longValue="10" booleanValue="false" timeValue="2012-09-13T15:00:34+02:00" entityValueUuid="string" agentValueUuid="string" goodValueUuid="string" placeValueUuid="string" consignmentValueUuid="string" contractValueUuid="string" projectValueUuid="string" employeeValueUuid="string" placeUuid="string">
|
21
|
+
<!--Optional:-->
|
22
|
+
<accountUuid>string</accountUuid>
|
23
|
+
<!--Optional:-->
|
24
|
+
<accountId>string</accountId>
|
25
|
+
<!--Optional:-->
|
26
|
+
<uuid>string</uuid>
|
27
|
+
<!--Optional:-->
|
28
|
+
<groupUuid>string</groupUuid>
|
29
|
+
<!--Optional:-->
|
30
|
+
<deleted>2009-10-14T09:16:36</deleted>
|
31
|
+
<!--Optional:-->
|
32
|
+
<file readMode="PARENT" changeMode="NONE" updated="2014-10-27T10:44:59" updatedBy="string" name="string" created="2013-06-17T19:14:58" filename="string" miniatureUuid="string">
|
33
|
+
<!--Optional:-->
|
34
|
+
<accountUuid>string</accountUuid>
|
35
|
+
<!--Optional:-->
|
36
|
+
<accountId>string</accountId>
|
37
|
+
<!--Optional:-->
|
38
|
+
<uuid>string</uuid>
|
39
|
+
<!--Optional:-->
|
40
|
+
<groupUuid>string</groupUuid>
|
41
|
+
<!--Optional:-->
|
42
|
+
<deleted>2005-09-12T10:55:02+02:00</deleted>
|
43
|
+
<!--Optional:-->
|
44
|
+
<code>string</code>
|
45
|
+
<!--Optional:-->
|
46
|
+
<externalcode>string</externalcode>
|
47
|
+
<!--Optional:-->
|
48
|
+
<description>string</description>
|
49
|
+
<!--Optional:-->
|
50
|
+
<contents>Y2FlbHVtcXVl</contents>
|
51
|
+
</file>
|
52
|
+
</attribute>
|
53
|
+
<!--Optional:-->
|
54
|
+
<contact address="string" phones="string" faxes="string" mobiles="string" email="string"/>
|
55
|
+
<!--Optional:-->
|
56
|
+
<slots>
|
57
|
+
<!--Zero or more repetitions:-->
|
58
|
+
<slot readMode="SELF" changeMode="NEIGHBOUR" updated="2009-11-03T13:39:15+01:00" updatedBy="string" name="string" warehouseUuid="string">
|
59
|
+
<!--Optional:-->
|
60
|
+
<accountUuid>string</accountUuid>
|
61
|
+
<!--Optional:-->
|
62
|
+
<accountId>string</accountId>
|
63
|
+
<!--Optional:-->
|
64
|
+
<uuid>string</uuid>
|
65
|
+
<!--Optional:-->
|
66
|
+
<groupUuid>string</groupUuid>
|
67
|
+
<!--Optional:-->
|
68
|
+
<deleted>2014-06-27T21:41:15+02:00</deleted>
|
69
|
+
<!--Optional:-->
|
70
|
+
<code>string</code>
|
71
|
+
<!--Optional:-->
|
72
|
+
<externalcode>string</externalcode>
|
73
|
+
<!--Optional:-->
|
74
|
+
<description>string</description>
|
75
|
+
</slot>
|
76
|
+
</slots>
|
77
|
+
</warehouse>
|
@@ -8,11 +8,8 @@ module MoySklad::Client
|
|
8
8
|
self.user = MoySklad.configuration.user_name
|
9
9
|
self.password = MoySklad.configuration.password
|
10
10
|
self.auth_type = :basic
|
11
|
-
|
12
|
-
|
13
|
-
self.include_format_in_path = false
|
14
|
-
self.collection_parser = Collection
|
15
|
-
end
|
11
|
+
self.include_format_in_path = false
|
12
|
+
self.collection_parser = Collection
|
16
13
|
|
17
14
|
@@template_path = File.join(File.dirname(__FILE__), '..', 'model', 'templates')
|
18
15
|
|
@@ -40,33 +37,15 @@ module MoySklad::Client
|
|
40
37
|
def collection_name
|
41
38
|
@collection_name ||= "#{element_name.classify}/list"
|
42
39
|
end
|
43
|
-
|
44
|
-
if ActiveResource::VERSION::STRING < '4.0.0'
|
45
|
-
def collection_path(prefix_options = {}, query_options = nil)
|
46
|
-
check_prefix_options(prefix_options)
|
47
|
-
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
48
|
-
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
|
49
|
-
end
|
50
|
-
end
|
51
40
|
end
|
52
41
|
|
53
42
|
# Override create method, this required because moysklad uses PUT instead of POST
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def destroy
|
60
|
-
_destroy
|
61
|
-
end
|
62
|
-
else
|
63
|
-
def create
|
64
|
-
run_callbacks :create do _create end
|
65
|
-
end
|
43
|
+
def create
|
44
|
+
run_callbacks :create do _create end
|
45
|
+
end
|
66
46
|
|
67
|
-
|
68
|
-
|
69
|
-
end
|
47
|
+
def destroy
|
48
|
+
run_callbacks :destroy do _destroy end
|
70
49
|
end
|
71
50
|
|
72
51
|
def save
|
@@ -10,6 +10,10 @@ module MoySklad::Client
|
|
10
10
|
|
11
11
|
attr_accessor :element_name
|
12
12
|
|
13
|
+
def mime_type
|
14
|
+
"*/*"
|
15
|
+
end
|
16
|
+
|
13
17
|
def decode(_data)
|
14
18
|
data = Hash.from_xml(_data)
|
15
19
|
fail MoySklad::BadApiResponse unless data
|
@@ -25,14 +29,8 @@ module MoySklad::Client
|
|
25
29
|
{ data: data, object: element_name[0].downcase + element_name[1..-1] }
|
26
30
|
end
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
MoySklad::Client::Collection.new(_data(data))
|
31
|
-
end
|
32
|
-
else
|
33
|
-
def collection(data)
|
34
|
-
_data(data)
|
35
|
-
end
|
32
|
+
def collection(data)
|
33
|
+
_data(data)
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -59,6 +59,15 @@ module MoySklad
|
|
59
59
|
MoySklad::Client::Base.site = @base_url = v
|
60
60
|
end
|
61
61
|
|
62
|
+
# Warehouse url.
|
63
|
+
# @attr value [String] defaults to
|
64
|
+
# `'https://online.moysklad.ru/exchange/rest/stock/xml'`
|
65
|
+
attr_reader :warehouse_url
|
66
|
+
|
67
|
+
def warehouse_url=(v)
|
68
|
+
MoySklad::Client::Base.warehouse_url = @warehouse_url = v
|
69
|
+
end
|
70
|
+
|
62
71
|
# Currency UUID.
|
63
72
|
# @attr value [String] defaults to
|
64
73
|
# `'131bf5ff-1ee5-11e4-67ed-002590a28eca'`
|
@@ -68,6 +77,7 @@ module MoySklad
|
|
68
77
|
@user_name = ''
|
69
78
|
@password = ''
|
70
79
|
@base_url = 'https://online.moysklad.ru/exchange/rest/ms/xml'
|
80
|
+
@warehouse_url = 'https://online.moysklad.ru/exchange/rest/stock/xml'
|
71
81
|
@currency = '131bf5ff-1ee5-11e4-67ed-002590a28eca'
|
72
82
|
end
|
73
83
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module MoySklad::Model
|
2
|
+
class StockTo < MoySklad::Client::Base
|
3
|
+
self.site = MoySklad.configuration.warehouse_url
|
4
|
+
|
5
|
+
def initialize(*args)
|
6
|
+
super(*args)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def element_name
|
11
|
+
"stockTO"
|
12
|
+
end
|
13
|
+
|
14
|
+
def collection_name
|
15
|
+
""
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
xml.warehouse(updated: updated, updatedBy: updatedBy, name: name, agentUuid: agentUuid, archived: archived, parentUuid: parentUuid) {
|
2
|
+
xml.accountUuid_ accountUuid
|
3
|
+
xml.accountId_ accountId
|
4
|
+
xml.uuid_ uuid
|
5
|
+
xml.groupUuid_ groupUuid
|
6
|
+
xml.deleted_ deleted
|
7
|
+
xml.code_ code
|
8
|
+
xml.externalcode_ externalcode
|
9
|
+
xml.description_ description
|
10
|
+
|
11
|
+
to_a(:attribute).each do |a|
|
12
|
+
xml.attribute(metadataUuid: a.metadataUuid, valueText: a.valueText, valueString: a.valueString,
|
13
|
+
doubleValue: a.doubleValue, longValue: a.longValue, booleanValue: a.booleanValue,
|
14
|
+
timeValue: a.timeValue, entityValueUuid: a.entityValueUuid, agentValueUuid: a.agentValueUuid,
|
15
|
+
goodValueUuid: a.goodValueUuid, placeValueUuid: a.placeValueUuid, consignmentValueUuid: a.consignmentValueUuid,
|
16
|
+
contractValueUuid: a.contractValueUuid, projectValueUuid: a.projectValueUuid, employeeValueUuid: a.employeeValueUuid,
|
17
|
+
goodUuid: a.goodUuid) {
|
18
|
+
|
19
|
+
xml.accountUuid_ a.accountUuid
|
20
|
+
xml.accountId_ a.accountId
|
21
|
+
xml.uuid_ a.uuid
|
22
|
+
xml.groupUuid_ a.groupUuid
|
23
|
+
xml.deleted_ a.deleted
|
24
|
+
a.to_a(:file).each do |f|
|
25
|
+
xml.file(name: f.name, created: f.created, filename: f.filename, miniatureUuid: f.miniatureUuid) {
|
26
|
+
|
27
|
+
xml.accountUuid_ f.accountUuid
|
28
|
+
xml.accountId_ f.accountId
|
29
|
+
xml.uuid_ f.uuid
|
30
|
+
xml.groupUuid_ f.groupUuid
|
31
|
+
xml.deleted_ f.deleted
|
32
|
+
xml.code_ f.code
|
33
|
+
xml.externalcode_ f.externalcode
|
34
|
+
xml.description_ f.description
|
35
|
+
xml.contents_ f.contents
|
36
|
+
}
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
xml.contact(address: contact.address, phones: contact.phones, faxes: contact.faxes, mobiles: contact.mobiles, email: contact.email)
|
42
|
+
|
43
|
+
to_a(:slots).each do |s|
|
44
|
+
xml.slot(updated: s.updated, updatedBy: s.updatedBy, name: s.name, warehouseUuid: s.warehouseUuid) {
|
45
|
+
xml.accountUuid_ s.accountUuid
|
46
|
+
xml.accountId_ s.accountId
|
47
|
+
xml.uuid_ s.uuid
|
48
|
+
xml.groupUuid_ s.groupUuid
|
49
|
+
xml.deleted_ s.deleted
|
50
|
+
xml.code_ s.code
|
51
|
+
xml.externalcode_ s.externalcode
|
52
|
+
xml.description_ s.description
|
53
|
+
}
|
54
|
+
end
|
55
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module MoySklad::Model
|
2
|
+
class Warehouse < MoySklad::Client::Base
|
3
|
+
def initialize(*args)
|
4
|
+
super(*args)
|
5
|
+
create_nested_collection(:slots)
|
6
|
+
end
|
7
|
+
|
8
|
+
def items(mode = 'POSITIVE_ONLY')
|
9
|
+
StockTo.find(:all, params: {storeUuid: self.uuid, stockMode: mode})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/moy_sklad/model.rb
CHANGED
data/lib/moy_sklad/version.rb
CHANGED
data/moy_sklad.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.3'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
24
24
|
|
25
|
-
spec.add_dependency 'activesupport', '>=
|
26
|
-
spec.add_dependency 'activeresource', '>=
|
25
|
+
spec.add_dependency 'activesupport', '>= 4.0', '<5.0'
|
26
|
+
spec.add_dependency 'activeresource', '>= 4.0', '<5.0'
|
27
27
|
spec.add_dependency 'nokogiri', '~> 1.6'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moy_sklad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uno4ki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,40 +59,40 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
63
|
-
- - "
|
62
|
+
version: '4.0'
|
63
|
+
- - "<"
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: '5.0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
73
|
-
- - "
|
72
|
+
version: '4.0'
|
73
|
+
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '5.0'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: activeresource
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
-
- - "
|
82
|
+
version: '4.0'
|
83
|
+
- - "<"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '5.0'
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
93
|
-
- - "
|
92
|
+
version: '4.0'
|
93
|
+
- - "<"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: '5.0'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: nokogiri
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- doc/xml/MOYsklad.xsd
|
132
132
|
- doc/xml/PaymentIn.xml
|
133
133
|
- doc/xml/README.md
|
134
|
+
- doc/xml/Warehouse.xml
|
134
135
|
- lib/moy_sklad.rb
|
135
136
|
- lib/moy_sklad/client.rb
|
136
137
|
- lib/moy_sklad/client/attribute.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- lib/moy_sklad/model/good_folder.rb
|
153
154
|
- lib/moy_sklad/model/invoice_out.rb
|
154
155
|
- lib/moy_sklad/model/payment_in.rb
|
156
|
+
- lib/moy_sklad/model/stock_to.rb
|
155
157
|
- lib/moy_sklad/model/supply.rb
|
156
158
|
- lib/moy_sklad/model/templates/cash_in.builder
|
157
159
|
- lib/moy_sklad/model/templates/company.builder
|
@@ -163,6 +165,8 @@ files:
|
|
163
165
|
- lib/moy_sklad/model/templates/invoice_out.builder
|
164
166
|
- lib/moy_sklad/model/templates/payment_in.builder
|
165
167
|
- lib/moy_sklad/model/templates/supply.builder
|
168
|
+
- lib/moy_sklad/model/templates/warehouse.builder
|
169
|
+
- lib/moy_sklad/model/warehouse.rb
|
166
170
|
- lib/moy_sklad/nokogiri/document.rb
|
167
171
|
- lib/moy_sklad/version.rb
|
168
172
|
- moy_sklad.gemspec
|
@@ -200,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
204
|
version: 1.3.1
|
201
205
|
requirements: []
|
202
206
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.
|
207
|
+
rubygems_version: 2.4.6
|
204
208
|
signing_key:
|
205
209
|
specification_version: 4
|
206
210
|
summary: MoySklad API wrapper
|