class EventbriteSDK::Organization

Constants

ALL

canceled ended finalized incomplete live started payout_issued

ALL_DISCOUNTS
CREATED_NEWEST_FIRST
ENDED

finalized payout_issued

SEARCH_ORDERS_STATUS_ACTIVE
SEARCH_ORDERS_STATUS_ACTIVE_AND_INACTIVE
SEARCH_ORDERS_STATUS_ALL

Search order values

SEARCH_ORDERS_STATUS_INACTIVE

Public Instance Methods

owned_events() click to toggle source

NOTE Shim to normalize API between a user/organization

# File lib/eventbrite_sdk/organization.rb, line 102
def owned_events
  events
end
search_orders(params={}) click to toggle source

Retrieve all orders for the organization based on given search criteria. changed_since - datetime - orders changed on or after the given datetime.

You can also pass a string formatted as %FT%TZ

exclude_emails - string array - do not include orders for these emails only_emails - string array - only include orders for these emails status - One of: all, active, inactive, active_and_inactive

This method does no parameter validation. If you pass an unsupported status or an invalid format changed_since you'll definitely hear about if from the endpoint.

# File lib/eventbrite_sdk/organization.rb, line 90
def search_orders(params={})
  coerce_search_orders_params(params)

  EventbriteSDK::ResourceList.new(
    url_base: "#{path}/orders",
    object_class: EventbriteSDK::Order,
    key: :orders,
    query: params
  )
end
upcoming_events(order_by: self.class::START_OLDEST_FIRST, status: self.class::ALL) click to toggle source

Query for all events, ordered by start date in ascending order.

order_by: Change the order they are returned. Supports:
  created_asc
  created_desc
  start_asc
  start_desc

status: Status(es) of events you want. Supports single values or CSV:
  all      - all available statuses. Includes:
  canceled - only canceled.
  draft    - only draft
  ended    - all ended statuses. Includes:
  live     - only live
  started  - only started
# File lib/eventbrite_sdk/organization.rb, line 65
def upcoming_events(order_by: self.class::START_OLDEST_FIRST,
                    status: self.class::ALL)
  EventbriteSDK::ResourceList.new(
    url_base: "#{path}/events",
    object_class: EventbriteSDK::Event,
    key: 'events',
    query: {
      order_by: order_by,
      status: status
    }
  )
end

Private Instance Methods

coerce_search_orders_params(params) click to toggle source
# File lib/eventbrite_sdk/organization.rb, line 108
def coerce_search_orders_params(params)
  format_changed_since(params)
  format_emails(params)

  params
end
format_changed_since(params) click to toggle source
# File lib/eventbrite_sdk/organization.rb, line 115
def format_changed_since(params)
  value = params[:changed_since]

  if value and value.respond_to?(:strftime)
    params[:changed_since] = value.strftime('%FT%TZ')
  end
end
format_emails(params) click to toggle source
# File lib/eventbrite_sdk/organization.rb, line 123
def format_emails(params)
  for key in %i(exclude_emails only_emails)
    if params[key] and params[key].any?
      params[key] = params[key].join(',')
    end
  end
end