Module: Elibri::Connect
- Defined in:
- lib/elibri_connect.rb,
lib/generators/elibri/connect/config/config_generator.rb,
lib/generators/elibri/connect/install/install_generator.rb,
lib/generators/elibri/connect/whenever/whenever_generator.rb,
lib/generators/elibri/connect/db_structure/db_structure_generator.rb
Defined Under Namespace
Classes: ConfigGenerator, DbStructureGenerator, InstallGenerator, WheneverGenerator
Class Attribute Summary collapse
-
.api_version ⇒ Object
Returns the value of attribute api_version.
-
.login ⇒ Object
Returns the value of attribute login.
-
.onix_dialect ⇒ Object
Returns the value of attribute onix_dialect.
-
.password ⇒ Object
Returns the value of attribute password.
-
.product_model ⇒ Object
Returns the value of attribute product_model.
-
.test_mode ⇒ Object
Returns the value of attribute test_mode.
-
.tracing_object ⇒ Object
Returns the value of attribute tracing_object.
Class Method Summary collapse
- .api_client ⇒ Object
- .setup {|_self| ... } ⇒ Object
- .update_products(refill_queue = false) ⇒ Object
- .update_products! ⇒ Object
Class Attribute Details
.api_version ⇒ Object
Returns the value of attribute api_version.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def api_version @api_version end |
.login ⇒ Object
Returns the value of attribute login.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def login @login end |
.onix_dialect ⇒ Object
Returns the value of attribute onix_dialect.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def onix_dialect @onix_dialect end |
.password ⇒ Object
Returns the value of attribute password.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def password @password end |
.product_model ⇒ Object
Returns the value of attribute product_model.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def product_model @product_model end |
.test_mode ⇒ Object
Returns the value of attribute test_mode.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def test_mode @test_mode end |
.tracing_object ⇒ Object
Returns the value of attribute tracing_object.
12 13 14 |
# File 'lib/elibri_connect.rb', line 12 def tracing_object @tracing_object end |
Class Method Details
.api_client ⇒ Object
19 20 21 22 |
# File 'lib/elibri_connect.rb', line 19 def self.api_client Elibri::ApiClient.new(:login => login, :password => password, :api_version => api_version, :onix_dialect => onix_dialect) end |
.setup {|_self| ... } ⇒ Object
15 16 17 |
# File 'lib/elibri_connect.rb', line 15 def self.setup(&block) yield self end |
.update_products(refill_queue = false) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elibri_connect.rb', line 24 def self.update_products(refill_queue = false) if test_mode book = Elibri::XmlMocks::Examples.book_example (self.product_model).to_s.capitalize.constantize.batch_create_or_update_from_elibri(Elibri::ONIX::XMLGenerator.new(book).to_s) else api = Elibri::ApiClient.new(:login => login, :password => password, :api_version => api_version, :onix_dialect => onix_dialect) api.refill_all_queues! if refill_queue while (queue = api.pending_queues.find { |q| q.name == 'meta' }) response = api.pop_from_queue('meta', :count => 25) (self.product_model).to_s.capitalize.constantize.batch_create_or_update_from_elibri(response.onix, self.tracing_object) end end end |
.update_products! ⇒ Object
40 41 42 |
# File 'lib/elibri_connect.rb', line 40 def self.update_products! self.update_products(true) end |