Skip to content

Commit

Permalink
Add dynamic passenger types/options to the passenger API
Browse files Browse the repository at this point in the history
  • Loading branch information
phylor committed Sep 5, 2023
1 parent 7bc870e commit 3010dc4
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/ioki/model/passenger/passenger_option.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class PassengerOption < Base
attribute :name, on: [:read, :create], type: :string
attribute :value, on: :create, type: :string # could also be a boolean or an integer

attribute :type, on: :read, type: :string
attribute :id, on: :read, type: :string
attribute :created_at, on: :read, type: :date_time
attribute :updated_at, on: :read, type: :date_time

attribute :bookable, on: :read, type: :boolean
attribute :data_type, on: :read, type: :string
attribute :option_type, on: :read, type: :string
attribute :localized_accessibility_information, on: :read, type: :string
attribute :localized_description, on: :read, type: :string
attribute :localized_info, on: :read, type: :string
attribute :localized_link, on: :read, type: :string
attribute :localized_link_text, on: :read, type: :string
attribute :localized_name, on: :read, type: :string
end
end
end
end
1 change: 1 addition & 0 deletions lib/ioki/model/passenger/ride.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Ride < Base
attribute :fare, on: :read, type: :object, class_name: 'Fare'
attribute :ticket, on: :read, type: :object, class_name: 'Ticket'
attribute :offered_solutions, on: :read, type: :array, class_name: 'OfferedSolution'
attribute :options, on: :create, type: :array, class_name: 'RideOption'
end
end
end
Expand Down
27 changes: 27 additions & 0 deletions lib/ioki/model/passenger/ride_option.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Ioki
module Model
module Passenger
class RideOption < Base
attribute :name, on: [:read, :create], type: :string
attribute :value, on: :create, type: :string # could also be a boolean or an integer

attribute :type, on: :read, type: :string
attribute :id, on: :read, type: :string
attribute :created_at, on: :read, type: :date_time
attribute :updated_at, on: :read, type: :date_time

attribute :bookable, on: :read, type: :boolean
attribute :data_type, on: :read, type: :string
attribute :option_type, on: :read, type: :string
attribute :localized_accessibility_information, on: :read, type: :string
attribute :localized_description, on: :read, type: :string
attribute :localized_info, on: :read, type: :string
attribute :localized_link, on: :read, type: :string
attribute :localized_link_text, on: :read, type: :string
attribute :localized_name, on: :read, type: :string
end
end
end
end
1 change: 1 addition & 0 deletions lib/ioki/model/passenger/ride_passenger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class RidePassenger < Base
attribute :type, on: [:create, :update], type: :string
attribute :walker, on: [:read, :create, :update], omit_if_blank_on: [:create, :update], type: :boolean
attribute :wheelchair, on: [:read, :create, :update], omit_if_blank_on: [:create, :update], type: :boolean
attribute :options, on: [:read, :create], type: :array, class_name: 'PassengerOption', omit_if_blank_on: :create
end
end
end
Expand Down

0 comments on commit 3010dc4

Please sign in to comment.