class GymFinder::Client::Slot

Attributes

client[RW]
court[RW]
date[RW]
gym[RW]
time_slot[RW]

Public Class Methods

new(gym:, court:, date:, time_slot:, client:) click to toggle source
# File lib/gym_finder/client.rb, line 51
def initialize(gym:, court:, date:, time_slot:, client:)
  @gym = gym
  @court = court
  @date = date
  @time_slot = time_slot
  @client = client
end

Public Instance Methods

to_json(*args) click to toggle source
# File lib/gym_finder/client.rb, line 59
def to_json(*args)
  {
    gym: @gym.name,
    type: @court.name,
    court: @time_slot.court,
    price: @time_slot.price,
    status: @time_slot.status,
    time: Time.new(@date.year, @date.month, @date.day, @time_slot.time).iso8601,
    gym_homepage: @gym.homepage,
    reservation_link: "https://#{@client.req.host}#{@client.req.path}?module=net_booking&files=booking_place&StepFlag=25&QPid=#{@time_slot.qpid}&QTime=#{@time_slot.time}&PT=#{@court.pt}&D=#{@date.strftime('%Y/%m/%d')}"
  }.to_json(*args)
end