rladies/meetupr

Problems with values for `event_status` in get_events()

Opened this issue · 0 comments

There's a few issues in get_events() handling of event_status. Firstly, the docs suggests that the default for this field is upcoming but the code has it as a vector of statuses.

Using the code defaults results in a 403 for my test groups:

> get_events('Ansible-Atlanta')
Error in fun(api_path = "Ansible-Atlanta/events", event_status = "upcoming,cancelled,draft,past,proposed,suggested",  : 
  Forbidden (HTTP 403).

While overriding to the documented default works:

> get_events('Ansible-Atlanta',event_status='past')
Downloading 24 record(s)...
# A tibble: 24 x 22
   id     name   created             status time               
   <chr>  <chr>  <dttm>              <chr>  <dttm>             
 1 22168… "Ansi… 2015-04-07 22:35:38 past   2015-05-20 00:30:00
...

I suspect this is because some event types are protected and can only be seen if you're logged in as that group owner. However, avoiding this by specifying a custom list of statuses returns a different error:

> get_events('Ansible-Atlanta',event_status=c('past','upcoming'))
Error in match.arg(event_status) : 'arg' must be of length 1

I think this is a typo. match.arg needs a set of valid choices, and we don't specify any in get_events() - but we do specify them in the .check_event_status() function. Should get_events be calling the internal function?

That doesn't help me understand why the function default of event_status = c("upcoming", "cancelled", "draft", "past", "proposed", "suggested") passes the match.arg check though, or why a single override works either ... what am I missing?