booking-ruby 0.1.4 → 0.1.5

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: 867aa4b580e5f826678be6de48a9ddd1c62141ca
4
- data.tar.gz: ebe78f6abe2f83f794d3ae413335465d0b73e7f3
3
+ metadata.gz: 1b0550f90543c4136165db0babbc7c8a5c99b313
4
+ data.tar.gz: acd49ee3294d17740533a71123205fbc0a4caaf8
5
5
  SHA512:
6
- metadata.gz: 25783f659992561a87528331e029745f874bbde29488defde35589a7b8c51c31563fa8c5b60606a84b03dae76f90d7b574962eb163a46b16e1c309e25f1c7f2b
7
- data.tar.gz: 68822a113b95cd41d45313896b81d07f4d8a7c62ae4f4bff22ffef37fd84532a4b32a555f6d8be12d47e616434d5832a230ec182fdc47a79090a5928dadab3a1
6
+ metadata.gz: 27a11bd857c85bc345bacbd81944364e970deb77bfa967b3d582bfa81e7c87c30779d4a5fbcafba5c721438fd1a27e34a978414f7f64aef0306cedcd304662f4
7
+ data.tar.gz: 7e11027627a752007df6f99e3374b5c0f622bbe38d7debfc992b1b21c103bb92e1c6d6f938f5ce94bce6609ac8b3ed545773d0eee901af8f907917adc81832ab
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "pry"
27
27
  spec.add_dependency "faraday", "~> 0.9"
28
28
  spec.add_dependency "faraday_middleware"
29
+ spec.add_dependency "activesupport"
29
30
  end
@@ -1,6 +1,8 @@
1
1
  require "faraday"
2
2
  require "faraday_middleware"
3
3
  require "json"
4
+ require "active_support/core_ext/hash/indifferent_access"
5
+
4
6
  require "booking_api/version"
5
7
  require "booking_api/client"
6
8
  require "booking_api/http_service"
@@ -3,8 +3,25 @@ module BookingApi
3
3
  module Images
4
4
  class Image
5
5
  attr_reader :raw_data
6
+
6
7
  def initialize(raw_data = {})
7
- @raw_data = raw_data
8
+ @raw_data = raw_data.with_indifferent_access
9
+ end
10
+
11
+ def hotel_id
12
+ @raw_data[:hotel_id].to_i
13
+ end
14
+
15
+ def photo_id
16
+ @raw_data[:photo_id].to_i
17
+ end
18
+
19
+ def largest_file_url
20
+ @raw_data[:url_original].gsub("max500", "840x460")
21
+ end
22
+
23
+ def is_default_image?
24
+ @raw_data[:descriptiontype_id].to_i == 10
8
25
  end
9
26
  end
10
27
  end
@@ -1,3 +1,3 @@
1
1
  module BookingApi
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: booking-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Kleinwaechter
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: activesupport
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description:
126
140
  email:
127
141
  - hendrik.kleinwaechter@gmail.com