Eventbrite API create private event - eventbrite

I'm using Eventbrite API to create events from my application, what I need are private events and I create them with this code:
$event_params = array(
'title' => $event->name,
'description' => $event->description,
'start_date' => $event->start_at,
'end_date' => $event->end_at,
'timezone' => 'Europe/Paris',
'privacy' => '0',
'venue_id' => $venue_id,
'organizer_id' => $organizer_id,
'capacity' => $event->capacity,
'currency' => 'EUR',
'locale' => 'fr_FR',
'status' => $event->status,
'custom_header' => '<img src="'.asset($event->placeholder_img).'" width="100%"/>'
);
$resp = $this->eb_client->event_new($event_params);
so the event is created in Eventbrite but it can be shared via social media: http://prntscr.com/6w0b20 and I don't want this thing, I was wondering if this social sharing could be avoid via Eventbrite API.
Thank you,
Adrian

Answered in our forum, but I'll leave it here as well.
By setting the 'event.shareable' parameter to False you will be able to shut off this feature via the API.
You can see the request parameters for Event Details (event_new's parity endpoint) here http://www.eventbrite.com/developer/v3/endpoints/events/#ebapi-post-events

Related

CakePHP 3 routing dynamic url

I have an eCommerce website and need to create some custom URLs. These URLs will be generated dynamically. The structure will be
Example URL: http://website.com/categoryname/product-title
Here the category name is dynamic. It will change for each product, it can be
website.com/buttons/CP1 or
website.com/ribbons/red so on
In any case these URLs should be redirected to http://website.com/products/productdetail/product-title
I tried the following script:
$routes->connect(
'/:type/:slug/*',
['controller' => 'Products','action' => 'productDetail'],
['type' => '\b(?:(?!admin)\w)+\b'],
[
'slug' => '[A-Za-z-]+',
'pass' => [
'slug'
]
]
);
['type' => '\b(?:(?!admin)\w)+\b'] is to exclude the other controllers. In this case 'Admin'. This works but the parameters passed through the URL (product-title) is not getting in the controller function(productDetail)
Any help will be appreciated.
It is fixed. Updated script below.
$routes->connect(
'/:type/:slug/*',
['controller' => 'Products','action' => 'productDetail'],
[
'type' => '\b(?:(?!admin)\w)+\b',
'pass' => ['slug']
]);
According to the API the connect() function only accepts 3 parameters and you are actually passing 4. See Cake Routing Router - Connect
I have not tested this at all, but I think you should re-write it like this:
$routes->connect(
'/:type/:slug/*',
['controller' => 'Products','action' => 'productDetail'],
[
'type' => '\b(?:(?!admin)\w)+\b',
'slug' => '[A-Za-z-]+',
'pass' => ['slug']
]
);

Send google analytics event in ruby

I have the following code for google analytics real time, in ruby:
# Execute the query
sa_visitCount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {
'ids' => "ga:" + saprofileID,
'metrics' => "ga:activeVisitors",
})
Followed with:
send_event('sa_realtimevisitors', current: sa_visitCount.data.rows)
This works great and returns an active visitor count.
Now I am trying to change this to return an event I have created on google analytics. Here is what the event looks like. You find this under Real-Time and Events. I am trying to use the Event Category "Ad" Listed as #2 in the screenshot.
The code I am using to attempt this in ruby is as follows.
phonehub_visitCount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {
'ids' => "ga:" + saprofileID,
'metrics' => "ga:sessionsWithEvent",
})
Followed with:
send_event('phonehub_event', current: phonehub_visitCount.data.rows)
This returns nothing. I'm still using the original GA ID, however I'm trying to tell it to look at the event I created. Is there a way in ruby to make the GA realtime return the results from the event? Ideally the solution I'm looking for is to return real time active visitors on the event I have made.
After further research I found that I had to specify v3 in the api method.
So instead of phonehub_visitCount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {
I had to use
api_method = client.discovered_api('analytics','v3').data.ga.get
Then add
phonehub_visitCount = client.execute(:api_method => api_method, :parameters => {

Rails MailChimp API Groups

I'm using the mailchimp-api gem in a rails 4 project. I can successfully subscribe a users email to a list, but can't get users into the group I'm specifying.
In Mailchimp I setup a Group with the name "UserType" as a checkbox. It has two groups within "User" and "Tech".
Here is my subscribe code:
#mc.lists.subscribe(list_id, {'email' => email}, {'merge_vars' => { 'groupings' => [{'name' => 'UserType', 'groups' => ['User']}]}})
I'm not receiving any errors and the email is still successfully being inserted into the list. Any ideas on why the user isn't being inserted into the "User" group?
Try add an array for each group into groupings.. In your case you should count 4 arrays....
See if my PHP code can help you:
'merge_vars' => array('fname' => $firstName, 'lname' => $lastName, 'groupings' => array(array('name'=> 'Test', 'groups' => array('Test1'))));

Yii url manager only ID in url

i have in YII for example domain: www.example.com/product-url-1234
how to set rules in urlManager and how to use controller/action/id
If you want to use this url www.example.eu/product-url-1234
and suppose 'index' is the name of the action of the 'user' controller that will handle the request
Then create a rule like
'<id:.*?>'=>'user/index'
Now if you will use Yii::app()->createUrl('user/index',array('id'=>'product-url-1234'))
then it will give you the desired result.
And if you Visit this Url, User/Index will handle the request.
You are trying forward all request to one controller at root level.
I Assumed that all your request are redirected product/view route
in your config go to URL section,
'(.*)'=>'product/view'
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'(.*)' => 'product/view',
'post/<id:\d+>/<title:.*?>' => 'post/view',
'posts/<tag:.*?>' => 'post/index',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
that means you are capturing all your root requests to product controllers view action
Where you can get www.example.eu/product-url-1234 using
Yii::app()->request->requestUri in product/view
but this is not good way to capture all your incoming request to a single controller, the better way would be as follows.
www.example.eu/product/product-url-1234
then you have to change the configuration
'product/<product:.*?>'=>'product/view'
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'product/<product:.*?>' => 'product/view',
'post/<id:\d+>/<title:.*?>' => 'post/view',
'posts/<tag:.*?>' => 'post/index',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
in your view action, you can get the url through $_GET['product']

Google Calendar API v3 - Update Event

I'm using google-api-ruby-client for working with Google Calendar API v3.
The only problem I'm facing is with updating an event twice.
It has been discussed here before (Google Calendar api v3 re-update issue) but without ruby client and no answer.
When I add a new event I get an ID and an ETAG. I use ID to update the event and I get a new ETAG. Now If I try to update 2nd time, it doesn't update and sends 400 error with message "Invalid Value".
I have to send latest ETAG when updating 2nd time but I'm not sure how to send that when working with google-api-ruby-client.
Here's the code:
event = {
'summary' => "Summary",
'location' => "Location",
'description' => "Description",
'start' => {
'dateTime' => #entry.from_date
},
'end' => {
'dateTime' => #entry.to_date
}
}
result = client.execute(:api_method => service.events.update,
:parameters => {'calendarId' => #entry.calendar.gid, 'eventId'=>#entry.gid},
:body => JSON.dump(event),
:headers => {'Content-Type' => 'application/json'})
The docs are really sketchy on this but it seems you have to increment the sequence property each time you do an update. It's a revision control mechanism.
http://www.kanzaki.com/docs/ical/sequence.html

Resources