elibri_api_client 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
elibri.publishers.each do |publisher|
|
12
12
|
puts "#{publisher.name}, #{publisher.city} (#{publisher.products_count} produktow)"
|
13
13
|
publisher.products.each_with_index do |product, product_no|
|
14
|
-
puts "\t#{product_no}. #{product.
|
14
|
+
puts "\t#{product_no}. #{product.title}"
|
15
15
|
# puts product.onix_xml
|
16
16
|
end
|
17
17
|
end
|
data/elibri_api_client.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{elibri_api_client}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcin Urba\305\204ski"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-17}
|
13
13
|
s.description = %q{API client for elibri.com.pl publishing system}
|
14
14
|
s.email = %q{marcin@urbanski.vdl.pl}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -194,16 +194,16 @@ module Elibri #:nodoc:
|
|
194
194
|
# Unikalny identyfikator produktu w ONIX
|
195
195
|
attr_reader :record_reference
|
196
196
|
# Tytul produktu
|
197
|
-
attr_reader :
|
197
|
+
attr_reader :title
|
198
198
|
# Entrypoint API, pod ktorym mozna pobrac ONIX produktu
|
199
199
|
attr_reader :url
|
200
200
|
|
201
201
|
def initialize(api_adapter, publisher, attributes = {}) #:nodoc:
|
202
|
-
attributes.assert_valid_keys(:record_reference, :
|
202
|
+
attributes.assert_valid_keys(:record_reference, :title, :url)
|
203
203
|
@api_adapter = api_adapter
|
204
204
|
@publisher = publisher
|
205
205
|
@record_reference = attributes[:record_reference]
|
206
|
-
@
|
206
|
+
@title = attributes[:title]
|
207
207
|
@url = attributes[:url]
|
208
208
|
end
|
209
209
|
|
@@ -223,7 +223,7 @@ module Elibri #:nodoc:
|
|
223
223
|
Product.new(api_adapter, publisher,
|
224
224
|
:record_reference => product_xml['record_reference'],
|
225
225
|
:url => product_xml['url'],
|
226
|
-
:
|
226
|
+
:title => product_xml['title']
|
227
227
|
)
|
228
228
|
end
|
229
229
|
|
@@ -12,11 +12,11 @@ describe Elibri::ApiClient::ApiAdapters::V1::Product do
|
|
12
12
|
it "should have several attributes" do
|
13
13
|
product = Elibri::ApiClient::ApiAdapters::V1::Product.new(@api_adapter, @publisher,
|
14
14
|
:record_reference => 'AAAAAAAAAAAAAAA',
|
15
|
-
:
|
15
|
+
:title => 'Erlang Programming',
|
16
16
|
:url => 'http://api.elibri.com.pl/api/v1/products/AAAAAAAAAAAAAAA'
|
17
17
|
)
|
18
18
|
|
19
|
-
assert_equal 'Erlang Programming', product.
|
19
|
+
assert_equal 'Erlang Programming', product.title
|
20
20
|
assert_equal 'AAAAAAAAAAAAAAA', product.record_reference
|
21
21
|
assert_equal 'Wydawnictwo', product.publisher.name
|
22
22
|
end
|
@@ -25,11 +25,11 @@ describe Elibri::ApiClient::ApiAdapters::V1::Product do
|
|
25
25
|
|
26
26
|
it "should be able to build itself from provided XML" do
|
27
27
|
xml = %Q{
|
28
|
-
<product record_reference="04325b31fdece145d22e"
|
28
|
+
<product record_reference="04325b31fdece145d22e" title="Erlang Programming" url="http://api.elibri.com.pl/api/v1/products/04325b31fdece145d22e"/>
|
29
29
|
}
|
30
30
|
|
31
31
|
product = Elibri::ApiClient::ApiAdapters::V1::Product.build_from_xml(@api_adapter, @publisher, xml)
|
32
|
-
assert_equal 'Erlang Programming', product.
|
32
|
+
assert_equal 'Erlang Programming', product.title
|
33
33
|
assert_equal '04325b31fdece145d22e', product.record_reference
|
34
34
|
assert_equal "http://api.elibri.com.pl/api/v1/products/04325b31fdece145d22e", product.url
|
35
35
|
end
|
@@ -350,9 +350,9 @@ describe Elibri::ApiClient::ApiAdapters::V1 do
|
|
350
350
|
xml = <<-XML
|
351
351
|
<publisher id="#{@publisher.publisher_id}" name="Wydawnicta Naukowo-Techniczne">
|
352
352
|
<products count="3" url="#{FAKE_API_HOST}/api/v1/publishers/#{@publisher.publisher_id}/products">
|
353
|
-
<product
|
354
|
-
<product
|
355
|
-
<product
|
353
|
+
<product title="Erlang Programming" record_reference="04325b31fdece145d22e" url="#{FAKE_API_HOST}/api/v1/products/04325b31fdece145d22e"/>
|
354
|
+
<product title="The Little Schemer" record_reference="993140a24d8202a347cc" url="#{FAKE_API_HOST}/api/v1/products/993140a24d8202a347cc"/>
|
355
|
+
<product title="The Rails Way" record_reference="a40f41cf67facf1876e3" url="#{FAKE_API_HOST}/api/v1/products/a40f41cf67facf1876e3"/>
|
356
356
|
</products>
|
357
357
|
</publisher>
|
358
358
|
XML
|
@@ -367,7 +367,7 @@ describe Elibri::ApiClient::ApiAdapters::V1 do
|
|
367
367
|
assert(products.all? { |product| product.kind_of? Elibri::ApiClient::ApiAdapters::V1::Product })
|
368
368
|
|
369
369
|
erlang_programming = products.find {|product| product.record_reference == '04325b31fdece145d22e'}
|
370
|
-
assert_equal 'Erlang Programming', erlang_programming.
|
370
|
+
assert_equal 'Erlang Programming', erlang_programming.title
|
371
371
|
assert_equal '04325b31fdece145d22e', erlang_programming.record_reference
|
372
372
|
assert_equal "#{FAKE_API_HOST}/api/v1/products/04325b31fdece145d22e", erlang_programming.url
|
373
373
|
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:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Marcin Urba\xC5\x84ski"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-17 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|