Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ca tix m v2 #19

Merged
merged 7 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
TICKETMASTER_API_KEY: ${{ secrets.TICKETMASTER_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/api/v1/attendees_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def create
end

def destroy
attendee = Attendee.find_by(user_id: params[:id])
attendee = Attendee.find_by(id: params[:id])

if attendee
attendee.destroy
render json: { message: 'Attendee removed successfully' }, status: :ok
Expand Down
9 changes: 9 additions & 0 deletions app/facades/ticket_master_facade.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class TicketMasterFacade
def get_artist_events(artist)
json = TicketMasterService.get_events(artist)

json[:_embedded][:events].map do |event_data|
Event.new(event_data)
end
end
end
10 changes: 10 additions & 0 deletions app/poros/event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Event
attr_reader :venue_name, :date, :time, :artist_name

def initialize(event_data)
@venue_name = event_data[:_embedded][:venues][0][:name]
@date = event_data[:dates][:start][:localDate]
@time = event_data[:dates][:start][:localTime]
@artist_name = event_data[:name]
end
end
16 changes: 16 additions & 0 deletions app/services/ticket_master_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class TicketMasterService

def self.conn
Faraday.new(url: "https://app.ticketmaster.com/discovery/v2/") do |faraday|

end
end

def self.get_events(keyword)
api_key = Rails.application.credentials.ticket_master[:api_key]

response = conn.get("events.json?keyword=#{keyword}&apikey=#{api_key}")

JSON.parse(response.body, symbolize_names: true)
end
end
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lpXII7/AGUxN45BL1crKhuAcYqG5qyB1NWb+5H1CJb9HWoFenFq8q/KybMNPRf5c4/9UjEpMJ+ca3s1nYxZhjxbNk8LdWMKN+n8gUl2MMOiMvTNdFTuIhrZYWzFW7g7YhHCGMZogFRUSZ1+f+yYnQ4xj2Kzp1VXdhyk8PT+mgcOFk0hbm8oRtVpdl/GxnrgVbprprjxkY1w7+9Ii8sQZwPUB/DMh41MCCXxoiw/7NeBzh3nzQQylo6S6D20Y43qya19EzQMCPqXjz5+Ar3Sb1QmiLSYbyV/RoM7G6xcsk+obuv4PjHHydIllK+6+CLxH1YhRWAKluA31Ij7oLO8XM20ldFt+fpcJzBJ0CgKwseOOABYtrit7sEQKiH8ne1X1CfunFZKtc9JACjfCXsyYn/ZMk9Fz--FNYvnIx9QFHm0sSF--CNq9qqxF/3J3A65DEy8maw==
8C4UbG1b+ed2ZWJJBygTR57QcJsxoLlA+TAdxE6Xawu4KP1ya9PhyCQDL7kfMufvtRkXbQ/OeVQ/5jby7FsKks/PLDs07DVztAjUUYUX+lm+bDSCym5EMsNDerrqveWS6hermKPwMA7H43POYLyquTWSpWUFGcFipECKzCr1MXDOwvbqnhyseVMQDFKje1kER7EbGZN2AlVwapIlzHEvYPNBrI0SR93SqRCJDrpjwqfL5AaokEVE4f8iXRIxZsEBbhQl4hTXl8uDsIHJg5G7YDdjU7hoNLHDov+DP9EyCXi+kS4uHWb0E+nKODsLsIqT9B1Mc/JihBCdHbJuiErK5GUH4ssv257nJqiHNvJeImh9MwraY2W2mcJdPL4IO4dC+hI9hpmvJ1L6oquFQNHWxYZG+/r6fXVnlQZVIheRX+6DctOxKwisIz/NdJR0rzL1YnBm/zB+Z3cZeanYZTUg1PlfgtNnbOXlsa+eG1uNA/I=--wzm8mFs0n7kCs0h3--e0+pl0GxLerivFK2v+YNtg==
Loading
Loading