archivist-client 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Mzk5MTRjNGM2MWNiZjUwMWY4ODI0N2M5OWI3ZmM5YzUxYjQxMmJjMA==
5
- data.tar.gz: !binary |-
6
- YTAyOWNlYTk3OTFlNzBkOTQ3MTBjZjgzZTY0MjY1YTE2M2E1NjgxZg==
2
+ SHA1:
3
+ metadata.gz: e7704b95e3bc73ba04777f7c7be9b5b6930f3843
4
+ data.tar.gz: c3c3dca6cc795170838e5d944fdc1814b125703c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDE4YWEwMDM2NTdjY2E3OTYzMjJmNzJiMGVkNjM5MjE5YjY5NzJiZDM2OGM4
10
- NDFjMjQ5OGE3YThjYjRkZjFjZDIwMzk0NDc5ZGIyZDA1ZDc0YmQ3ZDVmN2Iy
11
- ZjRlNjg3ZGQ3NjYwYTIzOTNmNGYzODUxOTczYjc1ZGU3NDRiYzY=
12
- data.tar.gz: !binary |-
13
- OWMzNWZhOWQyYWY4ZGU3NmFmMjVkMTI0MGY3ODVhMjVlZGY0NWJjM2RmNjI1
14
- MDFlYzgzMzRhNDY5MmMzNjliYWQyZDAwYzIzMTNlMDNlYmE3YjQwN2JjMDVl
15
- MWYxNjJmOTcwOTkxNTc4M2ZhODZhM2VjZjEzMTdmNzlkODljZTA=
6
+ metadata.gz: 0de6ce9accf8abacbbafc168ca37938c0f91b8dd963e90528d4e965973b16ca6d513979c08800ef40f63b898e111db2d41740db3ceb198b926d0b6fcb70f4daf
7
+ data.tar.gz: 05011890ed16175915b2091a691f0f9ae937d80bde858e37cedcb81a40f45be076270efa33a3a0af4891c1b509e30abe623a89232bf6d253c7d5965785d4d063
@@ -42,7 +42,6 @@ module Archivist
42
42
  Model::QueryResponse.new.tap do |qr|
43
43
  response = @conn.get('/advancedsearch.php', params(opts))
44
44
  rep = Representation::QueryResponse.new(qr)
45
- puts "#{rep.inspect}"
46
45
  rep.from_json(response.body)
47
46
  end
48
47
  end
@@ -1,5 +1,5 @@
1
1
  module Archivist
2
2
  module Client
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
@@ -6,6 +6,8 @@ require 'date'
6
6
  module Archivist
7
7
  module Model
8
8
  class Document
9
+ UnsupportedFormat = Class.new(StandardError)
10
+
9
11
  include Virtus.model
10
12
 
11
13
  include Archivist::Client::Constants
@@ -33,9 +35,13 @@ module Archivist
33
35
  def download(format=:text)
34
36
  # e.g. format_index.text_format
35
37
  file_format = format_index.send(:"#{format}_format")
36
- # e.g. /download/firstbooknapole00gruagoog/firstbooknapole00gruagoog_djvu.txt
37
- @conn.get(download_path(file_format.name)).
38
- body.force_encoding('UTF-8')
38
+ if file_format.nil?
39
+ raise UnsupportedFormat, "#{identifier} not available in format #{format}"
40
+ else
41
+ # e.g. /download/firstbooknapole00gruagoog/firstbooknapole00gruagoog_djvu.txt
42
+ @conn.get(download_path(file_format.name)).
43
+ body.force_encoding('UTF-8')
44
+ end
39
45
  end
40
46
 
41
47
  def download_path(file)
@@ -8,6 +8,7 @@ module Archivist
8
8
  attribute :formats
9
9
 
10
10
  def find(key)
11
+ return nil if formats.nil?
11
12
  formats.find{ |value| value.format == key }
12
13
  end
13
14
  alias_method :[], :find
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archivist-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duane Johnson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-05 00:00:00.000000000 Z
12
+ date: 2014-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake