Sha256: 1ccede894b93bc3946443294edd8898729c09fb18fbe3d013ede7a1895fea262

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

require 'rakuten_web_service/resource'

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

      set_parser do |response|
        response['Items'].map { |item| self.new(item['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

7 entries across 7 versions & 1 rubygems

Version Path
rakuten_web_service-1.5.0 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.4.2 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.4.1 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.4.0 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.3.0 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.2.0 lib/rakuten_web_service/gora/plan.rb
rakuten_web_service-1.1.1 lib/rakuten_web_service/gora/plan.rb