Sha256: c0b4b5917efbeceecf44773a0fea4c924fa3d28b77961c8d8d10cb916156a52b

Contents?: true

Size: 1.76 KB

Versions: 3

Compression:

Stored size: 1.76 KB

Contents

# frozen_string_literal: true

require 'rakuten_web_service/resource'

module RakutenWebService
  module Gora
    class Plan < Resource
      endpoint 'https://app.rakuten.co.jp/services/api/Gora/GoraPlanSearch/20170623'

      parser do |response|
        response['Items'].map { |item| new(item) }
      end

      attribute :golfCourseId, :golfCourseName, :golfCourseAbbr, :golfCourseNameKana, :golfCourseCaption,
                :address, :latitude, :longitude, :highway, :golfCourseDetailUrl, :reserveCalUrl, :ratingUrl,
                :golfCourseImageUrl, :evaluation

      def plan_info
        get_attribute('planInfo').map { |plan| PlanInfo.new(plan['plan']) }
      end

      class PlanInfo < Resource
        class << self
          def search(_options)
            raise 'There is no API endpoint for this resource.'
          end
        end
        attribute :planId, :planName, :planType, :limitedTimeFlag, :price, :basePrice, :salesTax, :courseUseTax,
                  :otherTax, :playerNumMin, :playerNumMax, :startTimeZone, :round, :caddie, :cart, :assu2sum,:addFee2bFlag,
                  :addFee2b, :assortment2bFlag, :addFee3bFlag, :addFee3b, :assortment3bFlag, :discount4sumFlag, :lunch,
                  :drink, :stay, :lesson, :planOpenCompe, :compePlayGroupMin, :compePlayMemberMin, :compePrivilegeFree,
                  :compeOption, :other, :pointFlag, :point

        def call_info
          CallInfo.new(get_attribute('callInfo'))
        end

        class CallInfo < Resource
          class << self
            def search(_options)
              raise 'There is no API endpoint for this resource.'
            end
          end
          attribute :playDate, :stockStatus, :stockCount, :reservePageUrlPC, :reservePageUrlMobile
        end
      end
    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/gora/plan.rb
rakuten_web_service-1.13.1 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.13.0 lib/rakuten_web_service/gora/plan.rb