elibri_api_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gem "httparty", "~> 0.7.8"
4
- gem "nokogiri", "~> 1.4.6"
4
+ gem "nokogiri", "~> 1.5.0"
5
5
 
6
6
  group :development do
7
7
  gem "ruby-debug"
data/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GEM
14
14
  rbx-require-relative (> 0.0.4)
15
15
  minitest (2.2.2)
16
16
  mocha (0.9.12)
17
- nokogiri (1.4.6)
17
+ nokogiri (1.5.0)
18
18
  rake (0.9.0)
19
19
  rbx-require-relative (0.0.5)
20
20
  rcov (0.9.9)
@@ -33,6 +33,6 @@ DEPENDENCIES
33
33
  jeweler (~> 1.6.2)
34
34
  minitest
35
35
  mocha
36
- nokogiri (~> 1.4.6)
36
+ nokogiri (~> 1.5.0)
37
37
  rcov
38
38
  ruby-debug
@@ -0,0 +1,77 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{elibri_api_client}
8
+ s.version = "1.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Marcin Urba\305\204ski"]
12
+ s.date = %q{2011-07-06}
13
+ s.description = %q{API client for elibri.com.pl publishing system}
14
+ s.email = %q{marcin@urbanski.vdl.pl}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "elibri_api_client.gemspec",
27
+ "lib/elibri_api_client.rb",
28
+ "lib/elibri_api_client/api_adapters.rb",
29
+ "lib/elibri_api_client/api_adapters/v1.rb",
30
+ "lib/elibri_api_client/api_adapters/v1_helpers.rb",
31
+ "lib/elibri_api_client/core_extensions.rb",
32
+ "lib/elibri_api_client/version.rb",
33
+ "test/elibri_api_client_test.rb",
34
+ "test/elibri_api_v1_adapter_queue_test.rb",
35
+ "test/elibri_api_v1_adapter_test.rb",
36
+ "test/helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/elibri/elibri_api_client}
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.6.2}
42
+ s.summary = %q{API client for elibri.com.pl publishing system}
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<httparty>, ["~> 0.7.8"])
49
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.5.0"])
50
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
51
+ s.add_development_dependency(%q<mocha>, [">= 0"])
52
+ s.add_development_dependency(%q<minitest>, [">= 0"])
53
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
55
+ s.add_development_dependency(%q<rcov>, [">= 0"])
56
+ else
57
+ s.add_dependency(%q<httparty>, ["~> 0.7.8"])
58
+ s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
59
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
60
+ s.add_dependency(%q<mocha>, [">= 0"])
61
+ s.add_dependency(%q<minitest>, [">= 0"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<httparty>, ["~> 0.7.8"])
68
+ s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
69
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
70
+ s.add_dependency(%q<mocha>, [">= 0"])
71
+ s.add_dependency(%q<minitest>, [">= 0"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
74
+ s.add_dependency(%q<rcov>, [">= 0"])
75
+ end
76
+ end
77
+
@@ -4,13 +4,13 @@ module Elibri
4
4
  class ApiClient
5
5
  module ApiAdapters
6
6
 
7
- # Adapter dla 1 wersji API
7
+ # Adapter dla 1 wersji API. Instancję odpowiedniego adaptera tworzy klasa Elibri::ApiClient - nie
8
+ # robimy tego ręcznie.
8
9
  class V1
9
10
  URI_PREFIX = '/api/v1'
10
11
 
11
12
  include HTTParty
12
- debug_output $stderr
13
-
13
+ #debug_output $stderr
14
14
 
15
15
  def initialize(host_uri, login, password)
16
16
  @host_uri = host_uri
@@ -78,6 +78,8 @@ module Elibri
78
78
  end
79
79
 
80
80
 
81
+ # Trawersuj kolekcję produktów w nazwanej kolejce. Instancję nazwanej kolejki należy przekazać
82
+ # jako argument metody.
81
83
  def each_product(queue, &block)
82
84
  raise 'Need a Elibri::ApiClient::ApiAdapters::V1::Queue instance' unless queue.kind_of? Elibri::ApiClient::ApiAdapters::V1::Queue
83
85
 
@@ -91,7 +93,8 @@ module Elibri
91
93
  end
92
94
 
93
95
 
94
- # Ostatnio utworzone nazwane kolejki. Gdy wysypie nam się aplikacja, można przeglądać ostatnie pickupy.
96
+ # Ostatnio utworzone nazwane kolejki. Gdy wysypie nam się aplikacja, można przeglądać ostatnie pickupy
97
+ # i ponownie pobierać z nich dane.
95
98
  def last_pickups
96
99
  last_pickups = []
97
100
  %w{meta stocks}.each do |queue_name|
@@ -146,6 +149,7 @@ module Elibri
146
149
  end
147
150
 
148
151
 
152
+ # Jeśli Elibri zwóci jakiś błąd, to rzucamy odpowiednim wyjątkiem.
149
153
  def raise_if_error_present_in(response)
150
154
  raise Unauthorized, 'Bad login or password' if response.code == 401
151
155
 
@@ -3,6 +3,8 @@
3
3
  module Elibri
4
4
  class ApiClient
5
5
  module ApiAdapters
6
+
7
+ # Adapter dla pierwszej wersji API.
6
8
  class V1
7
9
 
8
10
  class UnknownError < RuntimeError; end
@@ -33,7 +35,6 @@ module Elibri
33
35
 
34
36
  # Zamiast rzeźbić ciągle w XML`u, tworzymy instancje kolejek.
35
37
  class Queue
36
-
37
38
  attr_reader :name, :items_total, :picked_up_at, :last_insert_at, :queue_id, :url
38
39
 
39
40
  def initialize(api_adapter, attributes = {})
@@ -4,7 +4,7 @@ module Elibri
4
4
  module Version
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
- PATCH = 1
7
+ PATCH = 2
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
10
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elibri_api_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Marcin Urba\xC5\x84ski"
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 11
44
+ hash: 3
45
45
  segments:
46
46
  - 1
47
- - 4
48
- - 6
49
- version: 1.4.6
47
+ - 5
48
+ - 0
49
+ version: 1.5.0
50
50
  name: nokogiri
51
51
  version_requirements: *id002
52
52
  prerelease: false
@@ -154,6 +154,7 @@ files:
154
154
  - LICENSE.txt
155
155
  - README.rdoc
156
156
  - Rakefile
157
+ - elibri_api_client.gemspec
157
158
  - lib/elibri_api_client.rb
158
159
  - lib/elibri_api_client/api_adapters.rb
159
160
  - lib/elibri_api_client/api_adapters/v1.rb