elibri_connect 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Now - depending on your situation you may choose one of four options:
|
|
33
33
|
|
34
34
|
If you have working application, and you need to add support to existing product model - please look here for more information about adding acts_as_elibri_product declaration to model (including traverse vector examples): [elibri/acts_as_elibri_product](https://github.com/elibri/acts_as_elibri_product)
|
35
35
|
|
36
|
-
After creation of config file, gem will provide you with rake task: `rake elibri:update_products` which will connect to elibri, download new and update existing product. You can also use it from your code using `Elibri::Connect.update_products
|
36
|
+
After creation of config file, gem will provide you with rake task: `rake elibri:update_products` which will connect to elibri, download new and update existing product. You can also use it from your code using `Elibri::Connect.update_products` method.
|
37
37
|
If you need to access raw api client - you can get it by invoking `Elibri::Connect.api_client`.
|
38
38
|
|
39
39
|
Gem has additional mode of operation called test_mode - you can get into it, by setting `test_mode=true` inside configuration file. When using it your application will not connect to elibri, instead it will use elibri_xml_mocks to mock and create product for your app.
|
@@ -61,4 +61,4 @@ Elibri::Connect.setup do |config|
|
|
61
61
|
config.product_model = :product #if you use other model than product - you need to set different name here
|
62
62
|
config.test_mode = true #- add this line to config if you want to avoid connecting to elibri and use mocked data
|
63
63
|
end
|
64
|
-
```
|
64
|
+
```
|
data/lib/elibri_connect.rb
CHANGED
@@ -17,23 +17,28 @@ module Elibri
|
|
17
17
|
|
18
18
|
def self.api_client
|
19
19
|
Elibri::ApiClient.new(:login => login, :password => password,
|
20
|
-
|
20
|
+
:api_version => api_version, :onix_dialect => onix_dialect)
|
21
21
|
end
|
22
|
-
|
23
|
-
def self.update_products
|
22
|
+
|
23
|
+
def self.update_products(refill_queue = false)
|
24
24
|
if test_mode
|
25
25
|
book = Elibri::XmlMocks::Examples.book_example
|
26
26
|
(self.product_model).to_s.capitalize.constantize.batch_create_or_update_from_elibri(Elibri::ONIX::XMLGenerator.new(book).to_s)
|
27
27
|
else
|
28
28
|
api = Elibri::ApiClient.new(:login => login, :password => password,
|
29
29
|
:api_version => api_version, :onix_dialect => onix_dialect)
|
30
|
-
|
31
|
-
|
30
|
+
|
31
|
+
api.refill_all_queues! if refill_queue
|
32
|
+
while (queue = api.pending_queues.find { |q| q.name == 'meta' })
|
32
33
|
response = api.pop_from_queue('meta', :count => 25)
|
33
34
|
(self.product_model).to_s.capitalize.constantize.batch_create_or_update_from_elibri(response.onix)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
38
|
+
|
39
|
+
def self.update_products!
|
40
|
+
self.update_products(true)
|
41
|
+
end
|
37
42
|
|
38
43
|
end
|
39
|
-
end
|
44
|
+
end
|
@@ -4,8 +4,14 @@
|
|
4
4
|
# end
|
5
5
|
|
6
6
|
namespace :elibri do
|
7
|
+
desc "Load products from elibri (refill queue) - creating and updating product where needed"
|
8
|
+
task :update_products! => :environment do
|
9
|
+
Elibri::Connect.update_products!
|
10
|
+
end
|
11
|
+
|
7
12
|
desc "Load products from elibri - creating and updating product where needed"
|
8
13
|
task :update_products => :environment do
|
9
|
-
Elibri::Connect.update_products
|
14
|
+
Elibri::Connect.update_products
|
10
15
|
end
|
11
|
-
|
16
|
+
|
17
|
+
end
|
metadata
CHANGED
@@ -1,193 +1,161 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: elibri_connect
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.1.6
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Piotr Szmielew
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2013-04-21 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
15
16
|
name: rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
|
-
requirements:
|
19
|
+
requirements:
|
19
20
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
+
- !ruby/object:Gem::Version
|
21
22
|
version: 3.2.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
31
27
|
name: acts_as_elibri_product
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
33
29
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version:
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
47
38
|
name: elibri_api_client
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
40
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version:
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
54
45
|
type: :runtime
|
55
46
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
63
49
|
name: elibri_onix_mocks
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
51
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version:
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
70
56
|
type: :runtime
|
71
57
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
79
60
|
name: whenever
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
62
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version:
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
86
67
|
type: :runtime
|
87
68
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
95
71
|
name: sqlite3
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
73
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version:
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
102
78
|
type: :development
|
103
79
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
80
|
+
version_requirements: *id006
|
81
|
+
- !ruby/object:Gem::Dependency
|
111
82
|
name: rspec
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
113
84
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version:
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
118
89
|
type: :development
|
119
90
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
91
|
+
version_requirements: *id007
|
92
|
+
- !ruby/object:Gem::Dependency
|
127
93
|
name: rspec-rails
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
129
95
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version:
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
134
100
|
type: :development
|
135
101
|
prerelease: false
|
136
|
-
version_requirements:
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
version: '0'
|
142
|
-
description: ! "Gem designed to allow easy addition of elibri based product system
|
143
|
-
to your application.\n Currently tested and support only on REE - due to dependencies."
|
144
|
-
email:
|
102
|
+
version_requirements: *id008
|
103
|
+
description: |-
|
104
|
+
Gem designed to allow easy addition of elibri based product system to your application.
|
105
|
+
Currently tested and support only on REE - due to dependencies.
|
106
|
+
email:
|
145
107
|
- p.szmielew@ava.waw.pl
|
146
108
|
executables: []
|
109
|
+
|
147
110
|
extensions: []
|
111
|
+
|
148
112
|
extra_rdoc_files: []
|
149
|
-
|
150
|
-
|
151
|
-
- lib/elibri_connect/version.rb
|
152
|
-
- lib/elibri_connect.rb
|
153
|
-
- lib/generators/elibri/connect/config/config_generator.rb
|
154
|
-
- lib/generators/elibri/connect/db_structure/db_structure_generator.rb
|
155
|
-
- lib/generators/elibri/connect/db_structure/templates/create_elibri_structure.rb
|
113
|
+
|
114
|
+
files:
|
156
115
|
- lib/generators/elibri/connect/install/install_generator.rb
|
157
116
|
- lib/generators/elibri/connect/whenever/whenever_generator.rb
|
117
|
+
- lib/generators/elibri/connect/db_structure/db_structure_generator.rb
|
118
|
+
- lib/generators/elibri/connect/db_structure/templates/create_elibri_structure.rb
|
119
|
+
- lib/generators/elibri/connect/config/config_generator.rb
|
120
|
+
- lib/elibri_connect/version.rb
|
121
|
+
- lib/elibri_connect/railtie.rb
|
122
|
+
- lib/elibri_connect.rb
|
158
123
|
- lib/tasks/elibri_connect_tasks.rake
|
159
124
|
- MIT-LICENSE
|
160
125
|
- Rakefile
|
161
126
|
- README.md
|
162
127
|
homepage: http://elibri.com.pl
|
163
128
|
licenses: []
|
129
|
+
|
164
130
|
post_install_message:
|
165
131
|
rdoc_options: []
|
166
|
-
|
132
|
+
|
133
|
+
require_paths:
|
167
134
|
- lib
|
168
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
136
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
segments:
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: -1455588321850379931
|
141
|
+
segments:
|
175
142
|
- 0
|
176
|
-
|
177
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
version: "0"
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
145
|
none: false
|
179
|
-
requirements:
|
180
|
-
- -
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
|
183
|
-
segments:
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: -1455588321850379931
|
150
|
+
segments:
|
184
151
|
- 0
|
185
|
-
|
152
|
+
version: "0"
|
186
153
|
requirements: []
|
154
|
+
|
187
155
|
rubyforge_project:
|
188
|
-
rubygems_version: 1.8.
|
156
|
+
rubygems_version: 1.8.23
|
189
157
|
signing_key:
|
190
158
|
specification_version: 3
|
191
|
-
summary: Gem designed to allow easy addition of elibri based product system to your
|
192
|
-
application.
|
159
|
+
summary: Gem designed to allow easy addition of elibri based product system to your application.
|
193
160
|
test_files: []
|
161
|
+
|