getyourguide 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e05ae22a2e53752715bc134b0c85371625fafd7
4
- data.tar.gz: d0abb5f1a7f9dd3ecb434e63ebfe24a2e0013152
3
+ metadata.gz: 5224de588ef66eaecc58981e13c4f95e9d3ffc4f
4
+ data.tar.gz: 183d9d3046121a8e95cbb7f2ba2f09f47a9ce2a3
5
5
  SHA512:
6
- metadata.gz: 2d007c3ff036cf6915796381b158e3232ee838e96c4e4d04d59bf88aa38cd978441ae9a0ab974d0c42c738d4d45e5ab003abd677e9824818aed71c0066f1a160
7
- data.tar.gz: 05e01a8553ade61ffdb2e3ac33880ca71cfb380ce5e1361e6535de74aa7c2f480ca934d836eb3769b700e2e15cf2e063221ef452faf978edee7b70f596f73184
6
+ metadata.gz: c9055a0624d8e434ba6094f4e103f7222ab87b244226af9923f28d87595b7aa6e4fc64ee885119fa48437b213b7d26143e6fb4561259e4693fd4189bbb9db942
7
+ data.tar.gz: 77b1228e640ce7cc6c4abcc891724c8f0a340fd4290fdaaf69abbfbc07a1aa04e2c2200903953c71d5c10afaf0dba34f2924e02d55bf551de58adcd0cc49d822
@@ -7,6 +7,7 @@ require "GetYourGuide/errors/api_error"
7
7
  require "GetYourGuide/models/activity"
8
8
  require "GetYourGuide/models/category"
9
9
  require "GetYourGuide/models/destination"
10
+ require "GetYourGuide/models/image"
10
11
  require "GetYourGuide/models/image_format"
11
12
  require "GetYourGuide/models/location"
12
13
  require "GetYourGuide/models/top_category"
@@ -0,0 +1,12 @@
1
+ module GetYourGuide
2
+ module Models
3
+ class Image
4
+ attr_accessor :url, :ssl
5
+
6
+ def initialize(attributes)
7
+ @url = attributes[:url]
8
+ @ssl = attributes[:ssl]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -39,16 +39,27 @@ module GetYourGuide
39
39
  categories
40
40
  end
41
41
 
42
- def get_pictures_list(product_xml)
42
+ def get_pictures_list(pictures_xml)
43
43
  pictures = []
44
44
 
45
- product_xml.xpath('pictures').children.children.each do |picture|
46
- pictures << picture.inner_text if picture.inner_text != ''
45
+ pictures_xml.xpath('pictures').children.children.each do |picture|
46
+ unless picture.inner_text == ''
47
+ picture_attributes = {
48
+ :ssl => to_boolean(picture.attr('ssl')),
49
+ :url => picture.inner_text
50
+ }
51
+
52
+ pictures << GetYourGuide::Models::Image.new(picture_attributes)
53
+ end
47
54
  end
48
55
 
49
56
  pictures
50
57
  end
51
58
 
59
+ def to_boolean(input)
60
+ input == 'true'
61
+ end
62
+
52
63
  def get_indivative_price(product_xml)
53
64
  product_xml.xpath('price').children.first.children.each do |price|
54
65
  return price.children.inner_text.to_f if price.attr('currency') == 'EUR'
@@ -1,3 +1,3 @@
1
1
  module GetYourGuide
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getyourguide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Delhaye
@@ -101,6 +101,7 @@ files:
101
101
  - lib/getyourguide/models/activity.rb
102
102
  - lib/getyourguide/models/category.rb
103
103
  - lib/getyourguide/models/destination.rb
104
+ - lib/getyourguide/models/image.rb
104
105
  - lib/getyourguide/models/image_format.rb
105
106
  - lib/getyourguide/models/location.rb
106
107
  - lib/getyourguide/models/top_category.rb