Class: Echelon::UniversalStudiosOrlando::Park
- Defined in:
- lib/echelon/parks/universal_studios_orlando.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#json_data ⇒ Object
readonly
Returns the value of attribute json_data.
-
#park_id ⇒ Object
readonly
Returns the value of attribute park_id.
Instance Method Summary collapse
-
#initialize(access_token, park_id) ⇒ Park
constructor
A new instance of Park.
- #ride_list ⇒ Object
Methods inherited from Park
#find_by_id, #find_by_name, #rides
Constructor Details
#initialize(access_token, park_id) ⇒ Park
Returns a new instance of Park.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/echelon/parks/universal_studios_orlando.rb', line 66 def initialize(access_token, park_id) @park_id = park_id uri = URI.parse('https://services.universalorlando.com/api/pointsOfInterest') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE headers = { 'X-UNIWebService-ApiKey' => 'AndroidMobileApp', 'X-UNIWebService-Token' => access_token }.merge(SHARED_HEADERS) resp = http.get(uri.request_uri, headers) @json_data = JSON.parse(resp.body) end |
Instance Attribute Details
#json_data ⇒ Object (readonly)
Returns the value of attribute json_data.
59 60 61 |
# File 'lib/echelon/parks/universal_studios_orlando.rb', line 59 def json_data @json_data end |
#park_id ⇒ Object (readonly)
Returns the value of attribute park_id.
59 60 61 |
# File 'lib/echelon/parks/universal_studios_orlando.rb', line 59 def park_id @park_id end |
Instance Method Details
#ride_list ⇒ Object
61 62 63 64 |
# File 'lib/echelon/parks/universal_studios_orlando.rb', line 61 def ride_list park_rides = json_data['Rides'].keep_if { |r| r['VenueId'] == park_id } park_rides.inject({}) { |a, e| a[e['Id'].to_i] = e['MblDisplayName']; a } end |