sitra_client 0.1.0 → 0.2.0
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.
@@ -76,7 +76,7 @@ class TouristicObject
|
|
76
76
|
contact_entries.each do |c|
|
77
77
|
if types_ids.include?(c[:type][:id])
|
78
78
|
label = c[:type][@libelle]
|
79
|
-
contact_details[label] = c[:
|
79
|
+
contact_details[label] = c[:coordonnees][:fr]
|
80
80
|
end
|
81
81
|
end
|
82
82
|
contact_details
|
@@ -91,12 +91,12 @@ class TouristicObject
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def picture_url(default_url)
|
94
|
-
@
|
94
|
+
(@illustrations.nil? || @illustrations.empty?) ? default_url : @illustrations[0][:traductionFichiers][0][:url]
|
95
95
|
end
|
96
96
|
|
97
97
|
def service_provider
|
98
|
-
if @informationsActivite && @informationsActivite[:
|
99
|
-
@informationsActivite[:
|
98
|
+
if @informationsActivite && @informationsActivite[:prestataireActivites]
|
99
|
+
@informationsActivite[:prestataireActivites][:nom][@libelle]
|
100
100
|
elsif @informationsFeteEtManifestation
|
101
101
|
@informationsFeteEtManifestation[:nomLieu]
|
102
102
|
else
|
@@ -105,8 +105,8 @@ class TouristicObject
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def address_details
|
108
|
-
if @informationsActivite && @informationsActivite[:
|
109
|
-
@informationsActivite[:
|
108
|
+
if @informationsActivite && @informationsActivite[:prestataireActivites]
|
109
|
+
@informationsActivite[:prestataireActivites][:adresse]
|
110
110
|
else
|
111
111
|
@localisation[:adresse]
|
112
112
|
end
|
@@ -284,10 +284,10 @@ class TouristicObject
|
|
284
284
|
end
|
285
285
|
|
286
286
|
def parse_geoloc_details
|
287
|
-
if @informationsActivite.nil? || @informationsActivite[:
|
287
|
+
if @informationsActivite.nil? || @informationsActivite[:prestataireActivites].nil?
|
288
288
|
geoloc_details = @localisation[:geolocalisation]
|
289
289
|
else
|
290
|
-
geoloc_details = @informationsActivite[:
|
290
|
+
geoloc_details = @informationsActivite[:prestataireActivites][:geolocalisation]
|
291
291
|
end
|
292
292
|
geoloc_details
|
293
293
|
end
|
data/lib/sitra_client/version.rb
CHANGED
data/lib/sitra_client.rb
CHANGED
@@ -10,7 +10,7 @@ class SitraQueryTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
query = SitraQuery.new('dummy_key', 'dummy_identifier', {:first_key => 'first_value', :second_key => 'second_value'})
|
12
12
|
|
13
|
-
assert_equal '{"apiKey":"dummy_key","
|
13
|
+
assert_equal '{"apiKey":"dummy_key","projetId":"dummy_identifier","first_key":"first_value","second_key":"second_value"}', query.to_params
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
@@ -32,9 +32,9 @@ class TouristicObjectTest < Test::Unit::TestCase
|
|
32
32
|
hash_result = {
|
33
33
|
:informations => {
|
34
34
|
:moyensCommunication => [
|
35
|
-
{:type => {:libelleFr => "Téléphone", :id => 201}, :
|
36
|
-
{:type => {:libelleFr => "Mél", :id => 204}, :
|
37
|
-
{:type => {:libelleFr => "Fax", :id => 202}, :
|
35
|
+
{:type => {:libelleFr => "Téléphone", :id => 201}, :coordonnees => {:fr => "0123456789"}},
|
36
|
+
{:type => {:libelleFr => "Mél", :id => 204}, :coordonnees => {:fr => "my@email.fr"}},
|
37
|
+
{:type => {:libelleFr => "Fax", :id => 202}, :coordonnees => {:fr => "9876543201"}}
|
38
38
|
]
|
39
39
|
}
|
40
40
|
}
|
@@ -44,7 +44,11 @@ class TouristicObjectTest < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
should 'populate image details' do
|
47
|
-
hash_result = {
|
47
|
+
hash_result = {
|
48
|
+
:illustrations => [
|
49
|
+
{:type => "IMAGE", :traductionFichiers => [:url => "my/image/url"]}
|
50
|
+
]
|
51
|
+
}
|
48
52
|
touristic_object = TouristicObject.new(hash_result)
|
49
53
|
|
50
54
|
assert_equal 'my/image/url', touristic_object.picture_url('default.png')
|
@@ -53,7 +57,7 @@ class TouristicObjectTest < Test::Unit::TestCase
|
|
53
57
|
should 'populate address details' do
|
54
58
|
hash_result = {
|
55
59
|
:informationsActivite => {
|
56
|
-
:
|
60
|
+
:prestataireActivites => {
|
57
61
|
:nom => {:libelleFr => "my_service"},
|
58
62
|
:adresse => {:adresse1 => "my_address", :codePostal => "1234", :commune => {:nom => "my_city"}},
|
59
63
|
:geolocalisation => {:valide => true, :geoJson => {:coordinates => [0.1, 0.2]}}
|
@@ -137,11 +141,11 @@ class TouristicObjectTest < Test::Unit::TestCase
|
|
137
141
|
:type => 'ACTIVITE',
|
138
142
|
:informations => {
|
139
143
|
:moyensCommunication => [
|
140
|
-
{:type => {:libelleFr => "Téléphone"}, :
|
144
|
+
{:type => {:libelleFr => "Téléphone"}, :coordonnees => {:fr => "0123456789"}}
|
141
145
|
]
|
142
146
|
},
|
143
147
|
:informationsActivite => {
|
144
|
-
:
|
148
|
+
:prestataireActivites => {
|
145
149
|
:nom => {:libelleFr => "my_service"}
|
146
150
|
}
|
147
151
|
}
|
@@ -149,8 +153,8 @@ class TouristicObjectTest < Test::Unit::TestCase
|
|
149
153
|
|
150
154
|
touristic_object = TouristicObject.new(hash_result)
|
151
155
|
|
152
|
-
assert_equal "0123456789", touristic_object.information[:moyensCommunication][0][:
|
153
|
-
assert_equal "my_service", touristic_object.information[:
|
156
|
+
assert_equal "0123456789", touristic_object.information[:moyensCommunication][0][:coordonnees][:fr]
|
157
|
+
assert_equal "my_service", touristic_object.information[:prestataireActivites][:nom][:libelleFr]
|
154
158
|
end
|
155
159
|
|
156
160
|
should 'default to fr locale' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitra_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|