Skip to content

Commit

Permalink
Change to dynamic passenger types/options in the platform API
Browse files Browse the repository at this point in the history
  • Loading branch information
phylor committed Aug 30, 2023
1 parent 61d2a54 commit efd9002
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/ioki/model/platform/multilanguage_string.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Ioki
module Model
module Platform
class MultilanguageString < Base
attribute :type, on: :read, type: :string
attribute :name, on: :read, type: :string
attribute :translations, on: :read, type: :array, class_name: 'Translation'
end
end
end
end
24 changes: 24 additions & 0 deletions lib/ioki/model/platform/passenger_option.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

module Ioki
module Model
module Platform
class PassengerOption < Base
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 :name, on: :read, type: :string
attribute :option_type, on: :read, type: :string
attribute :name_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :description_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :info_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_text_translations, on: :read, type: :object, class_name: 'MultilanguageString'
end
end
end
end
14 changes: 12 additions & 2 deletions lib/ioki/model/platform/passenger_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ module Ioki
module Model
module Platform
class PassengerType < Base
unvalidated true # Specification not available.

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 :name, on: :read, type: :string
attribute :option_type, on: :read, type: :string
attribute :name_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :description_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :info_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_text_translations, on: :read, type: :object, class_name: 'MultilanguageString'
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/ioki/model/platform/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Product < Base
attribute :prebookable, on: :read, type: :boolean
attribute :provider, type: :object, on: :read, class_name: 'Provider'
attribute :ride_options, on: :read, type: :object, class_name: 'RideOptions'
attribute :passenger_options, on: :read, type: :array, class_name: 'PassengerOption'
attribute :passenger_types, on: :read, type: :array, class_name: 'PassengerType'
attribute :product_ride_options, on: :read, type: :array, class_name: 'RideOption'
attribute :ride_rating_criteria, on: :read, type: :array
attribute :service_time_info, on: :read, type: :string
attribute :timezone, on: :read, type: :object, class_name: 'Timezone'
Expand Down
24 changes: 24 additions & 0 deletions lib/ioki/model/platform/ride_option.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

module Ioki
module Model
module Platform
class RideOption < Base
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 :name, on: :read, type: :string
attribute :option_type, on: :read, type: :string
attribute :name_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :description_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :info_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_translations, on: :read, type: :object, class_name: 'MultilanguageString'
attribute :link_text_translations, on: :read, type: :object, class_name: 'MultilanguageString'
end
end
end
end
13 changes: 13 additions & 0 deletions lib/ioki/model/platform/translation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Ioki
module Model
module Platform
class Translation < Base
attribute :type, on: :read, type: :string
attribute :language, on: :read, type: :string
attribute :text, on: :read, type: :string
end
end
end
end

0 comments on commit efd9002

Please sign in to comment.