sitra_client 0.3.0 → 0.3.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66fa78fc78b2c5e03394114f5c3d1f2d6a2f41cd
4
- data.tar.gz: 45697c458676ff69f4705347ac3bd515be9e7864
3
+ metadata.gz: 0357752f2b5a6ceea65913ff05f25ecdf05785f4
4
+ data.tar.gz: 2d9cbd8d81777d4669a97147ce0b0cb4b9cb0b84
5
5
  SHA512:
6
- metadata.gz: 26b1e7a2448da40218d471825eccfea37408055f0b7e63b4ae6df260cf43d94a70f751b4144cc5ec740b82039bef7ab268929879aa6a3c14acd2fe5778c69691
7
- data.tar.gz: bd207e49c8da6321e04a1af58103df9492c952b1a27d641b774fe9a2a1a6f72a983d8afc3c570cab63de0ff716e6a4140922e3c2c70e18dec4620cdd6cc567f1
6
+ metadata.gz: 29f27cb33f878af6242e9d3846ab8ba4d04886640ff45f26937be823b36caacca3dcb81f7758c2abb63974870526027de2d71ea49a5385b5af397059b384f850
7
+ data.tar.gz: 1e73ba1a62c41c73867677c06ca5993f13b1f4433b6599f99d136315b195e201d704be1ed8a7851024c1fef31f0f6b5d68dc3fe09c120286b4c082a7aa4ea81f
@@ -31,6 +31,7 @@ module SitraClient
31
31
  end
32
32
 
33
33
  def self.query(criteria, all_results = false)
34
+ query_result = {}
34
35
  if all_results
35
36
  loops = 0
36
37
  criteria[:first] = 0
@@ -42,11 +43,15 @@ module SitraClient
42
43
  criteria[:first] += MAX_COUNT
43
44
  results += get_response(criteria).as_array
44
45
  end
46
+ query_result[:count] = response.results_count
47
+ query_result[:results] = results
45
48
  else
46
49
  response = get_response(criteria)
47
50
  results = response.as_array
51
+ query_result[:count] = response.results_count
52
+ query_result[:results] = results
48
53
  end
49
- results
54
+ query_result
50
55
  end
51
56
 
52
57
  private
@@ -90,8 +90,9 @@ class TouristicObject
90
90
  @informations.merge(specific_information)
91
91
  end
92
92
 
93
- def picture_url(default_url)
94
- (@illustrations.nil? || @illustrations.empty?) ? default_url : @illustrations[0][:traductionFichiers][0][:url]
93
+ def pictures
94
+ (@illustrations.nil? || @illustrations.empty?) ? [{}] :
95
+ @illustrations.collect {|i| i[:traductionFichiers][0].keep_if {|k, v| k.to_s.start_with?('url')}}
95
96
  end
96
97
 
97
98
  def service_provider
@@ -202,7 +203,7 @@ class TouristicObject
202
203
  end
203
204
  end
204
205
 
205
- def pdf_link
206
+ def multimedias
206
207
  @multimedias
207
208
  end
208
209
 
@@ -1,3 +1,3 @@
1
1
  module SitraClient
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -46,12 +46,12 @@ class TouristicObjectTest < Test::Unit::TestCase
46
46
  should 'populate image details' do
47
47
  hash_result = {
48
48
  :illustrations => [
49
- {:type => "IMAGE", :traductionFichiers => [:url => "my/image/url"]}
49
+ {:type => 'IMAGE', :traductionFichiers => [{:url => 'my/image/url', :urlListe => 'my/list/url', :urlFiche => 'my/details/url'}]}
50
50
  ]
51
51
  }
52
52
  touristic_object = TouristicObject.new(hash_result)
53
53
 
54
- assert_equal 'my/image/url', touristic_object.picture_url('default.png')
54
+ assert_equal [{:url => 'my/image/url', :urlListe => 'my/list/url', :urlFiche => 'my/details/url'}], touristic_object.pictures
55
55
  end
56
56
 
57
57
  should 'populate address details' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitra_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeanbaptistevilain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler