Class: VividSeatApi::Base
- Inherits:
-
Object
- Object
- VividSeatApi::Base
- Defined in:
- lib/vivid_seat_api/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #base_url ⇒ Object
- #builder_options(options) ⇒ Object
- #get_query_api(url, options) ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #make_request_url(url, options) ⇒ Object
- #post_query_api(url, options) ⇒ Object
- #session ⇒ Object
- #to_query(options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
31 32 33 |
# File 'lib/vivid_seat_api/base.rb', line 31 def initialize(={}) @sandboxed = .fetch(:sandboxed, false) end |
Instance Method Details
#base_url ⇒ Object
35 36 37 |
# File 'lib/vivid_seat_api/base.rb', line 35 def base_url raise BaseUrlMissing, "#{self}.fetch not implemented" #"https://brokers.vividseats.com/webservices/listings/v1/" end |
#builder_options(options) ⇒ Object
43 44 45 46 |
# File 'lib/vivid_seat_api/base.rb', line 43 def .merge!(apiToken: VividSeatApi.configuration.api_token) to_query() end |
#get_query_api(url, options) ⇒ Object
48 49 50 |
# File 'lib/vivid_seat_api/base.rb', line 48 def get_query_api url, session.get(make_request_url(url, )).body end |
#make_request_url(url, options) ⇒ Object
39 40 41 |
# File 'lib/vivid_seat_api/base.rb', line 39 def make_request_url url, "#{url}?#{()}" end |
#post_query_api(url, options) ⇒ Object
52 53 54 55 |
# File 'lib/vivid_seat_api/base.rb', line 52 def post_query_api url, () session.post(url, ()).body end |
#session ⇒ Object
61 62 63 64 65 66 |
# File 'lib/vivid_seat_api/base.rb', line 61 def session @connection ||= ::Faraday.new base_url do |conn| conn.use Faraday::Response::VividSeat conn.adapter Faraday.default_adapter end end |
#to_query(options) ⇒ Object
57 58 59 |
# File 'lib/vivid_seat_api/base.rb', line 57 def to_query() Faraday::Utils.build_nested_query() end |