Sha256: 7e50eb3e92781f49a4b0302e0a51e23d756b06d2c40614bf8384f7380b688637
Contents?: true
Size: 877 Bytes
Versions: 10
Compression:
Stored size: 877 Bytes
Contents
module EventbriteSDK class Report STRING_KEYS = %i[ start_date end_date date_facet event_status timezone group_by ].freeze VALID_REPORTS = %i[attendees sales].freeze def initialize @query = {} end def event_ids(*ids) @query[:event_ids] = ids.join(',') self end def filter_by(filters) @query[:filter_by] = filters.to_json self end STRING_KEYS.each do |method| define_method(method) do |value| @query[method] = value self end end def query @query.dup # Don't allow mutation end def retrieve(type = nil, sdk = EventbriteSDK) unless VALID_REPORTS.include?(type) raise ArgumentError, "`:type` is not of #{VALID_REPORTS}" end sdk.get(url: "reports/#{type}", query: query) end end end
Version data entries
10 entries across 10 versions & 1 rubygems