Sha256: 15c3cc456af603f2a80a33ee2088bf40bc9c3f8c7d5bb1d13495dff271e6c8f5

Contents?: true

Size: 785 Bytes

Versions: 3

Compression:

Stored size: 785 Bytes

Contents

# frozen_string_literal: true

require 'rakuten_web_service/travel/resource'

module RakutenWebService
  module Travel
    class Hotel < RakutenWebService::Travel::Resource
      endpoint 'https://app.rakuten.co.jp/services/api/Travel/SimpleHotelSearch/20170426'

      parser do |response|
        response['hotels'].map do |hotel_info|
          Hotel.new(hotel_info)
        end
      end

      def initialize(params)
        @params = {}
        self.class.attribute_names.each_with_index do |key, i|
          @params[key] = params[i][key] if params[i]
        end
      end

      def self.attribute_names
        %w(hotelBasicInfo hotelRatingInfo hotelDetailInfo hotelFacilitiesInfo hotelPolicyInfo hotelOtherInfo)
      end

      attribute *attribute_names
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rakuten_web_service-1.13.2 lib/rakuten_web_service/travel/hotel.rb
rakuten_web_service-1.13.1 lib/rakuten_web_service/travel/hotel.rb
rakuten_web_service-1.13.0 lib/rakuten_web_service/travel/hotel.rb