Sha256: ea9a8ff6e934a3e454bde989839d07ff277c4e0810dd98c83e8fb6dc6ecb9910

Contents?: true

Size: 949 Bytes

Versions: 35

Compression:

Stored size: 949 Bytes

Contents

module Centaman
  class Service::Extra < Centaman::Service
    include Centaman::JsonWrapper
    attr_reader :booking_time_id

    def after_init(args)
      @booking_time_id = args[:booking_time_id]
      require_args
    end

    def endpoint
      '/ticket_services/TimedTicketExtra'
    end

    def object_class
      Centaman::Object::Extra
    end

    def options
      super + [
        { key: 'TimedTicketTypeId', value: booking_time_id }
      ]
    end

    def require_args
      raise "booking_time_id is required for #{self.class.name}" if booking_time_id.nil?
    end

    def sample_response
      [{
        'ExtraId' => 581,
        'ExtraDescription' => 'Bar Package Cocktail Cruises',
        'ExtraPrice' => 22.05,
        'DepositPercentage' => 100.0,
        'IsTaxInclusive' => true, 'TaxPercentage' => 10.25
      }]
    end

    def objects
      Rails.env.test? ? build_objects(sample_response) : super
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
centaman-5.0.4 lib/centaman/service/extra.rb
centaman-5.0.3 lib/centaman/service/extra.rb
centaman-5.0.2 lib/centaman/service/extra.rb
centaman-5.0.1 lib/centaman/service/extra.rb
centaman-5.0.0 lib/centaman/service/extra.rb
centaman-4.0.5 lib/centaman/service/extra.rb
centaman-4.0.4 lib/centaman/service/extra.rb
centaman-4.0.3 lib/centaman/service/extra.rb
centaman-4.0.2 lib/centaman/service/extra.rb
centaman-4.0.1 lib/centaman/service/extra.rb
centaman-3.1.2 lib/centaman/service/extra.rb
centaman-3.1.1 lib/centaman/service/extra.rb
centaman-3.1.0 lib/centaman/service/extra.rb
centaman-3.0.0 lib/centaman/service/extra.rb
centaman-2.1.0 lib/centaman/service/extra.rb
centaman-2.0.0 lib/centaman/service/extra.rb
centaman-1.0.0 lib/centaman/service/extra.rb
centaman-0.2.3 lib/centaman/service/extra.rb
centaman-0.2.2 lib/centaman/service/extra.rb
centaman-0.2.1 lib/centaman/service/extra.rb