Class: GymFinder::Client::Slot
- Inherits:
-
Object
- Object
- GymFinder::Client::Slot
- Defined in:
- lib/gym_finder/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#court ⇒ Object
Returns the value of attribute court.
-
#date ⇒ Object
Returns the value of attribute date.
-
#gym ⇒ Object
Returns the value of attribute gym.
-
#time_slot ⇒ Object
Returns the value of attribute time_slot.
Instance Method Summary collapse
-
#initialize(gym:, court:, date:, time_slot:, client:) ⇒ Slot
constructor
A new instance of Slot.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(gym:, court:, date:, time_slot:, client:) ⇒ Slot
Returns a new instance of Slot.
51 52 53 54 55 56 57 |
# 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 |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
50 51 52 |
# File 'lib/gym_finder/client.rb', line 50 def client @client end |
#court ⇒ Object
Returns the value of attribute court.
50 51 52 |
# File 'lib/gym_finder/client.rb', line 50 def court @court end |
#date ⇒ Object
Returns the value of attribute date.
50 51 52 |
# File 'lib/gym_finder/client.rb', line 50 def date @date end |
#gym ⇒ Object
Returns the value of attribute gym.
50 51 52 |
# File 'lib/gym_finder/client.rb', line 50 def gym @gym end |
#time_slot ⇒ Object
Returns the value of attribute time_slot.
50 51 52 |
# File 'lib/gym_finder/client.rb', line 50 def time_slot @time_slot end |
Instance Method Details
#to_json(*args) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# 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 |