Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ads api support [WIP] #687

Closed
wants to merge 138 commits into from

Conversation

thomas-holmes
Copy link

Accounts

  • GET accounts/:account_id
  • GET accounts

Campaigns

  • GET accounts/:account_id/campaigns
  • GET accounts/:account_id/campaigns/:campaign_id
  • POST accounts/:account_id/campaigns
  • PUT accounts/:account_id/campaigns/:campaign_id
  • DELETE accounts/:account_id/campaigns/:campaign_id

Line Items

  • GET accounts/:account_id/line_items/:line_item_id
  • GET accounts/:account_id/line_items
  • POST accounts/:account_id/line_items
  • PUT accounts/:account_id/line_items/:line_item_id
  • DELETE accounts/:account_id/line_items/:line_item_id

Promoted Accounts

  • GET accounts/:account_id/promoted_accounts
  • POST accounts/:account_id/promoted_accounts

Promotable Users

  • GET accounts/:account_id/promotable_users

Promoted Tweets

  • GET accounts/:account_id/promoted_tweets
  • POST accounts/:account_id/promoted_tweets
  • DELETE accounts/:account_id/promoted_tweets/:id

Funding Instruments

  • GET accounts/:account_id/funding_instruments
  • GET accounts/:account_id/funding_instruments/:id

Targeting Suggestions

  • GET accounts/:account_id/targeting_suggestions

Reach Estimate

  • GET accounts/:account_id/reach_estimate

Targeting Criteria

  • GET accounts/:account_id/targeting_criteria
  • GET accounts/:account_id/targeting_criteria/:id
  • POST accounts/:account_id/targeting_criteria
  • PUT accounts/:account_id/targeting_criteria
  • DELETE accounts/:account_id/targeting_criteria/:id
  • GET targeting_criteria/app_store_categories
  • GET targeting_criteria/behavior_taxonomies
  • GET targeting_criteria/behaviors
  • GET targeting_criteria/devices
  • GET targeting_criteria/interests
  • GET targeting_criteria/languages
  • GET targeting_criteria/locations
  • GET targeting_criteria/network_operators
  • GET targeting_criteria/platform_versions
  • GET targeting_criteria/platforms
  • GET targeting_criteria/tv_channels
  • GET targeting_criteria/tv_genres
  • GET targeting_criteria/tv_markets
  • GET targeting_criteria/tv_shows

Tailored Audiences

  • GET accounts/:account_id/tailored_audiences
  • GET accounts/:account_id/tailored_audiences/:id
  • POST accounts/:account_id/tailored_audiences
  • DELETE accounts/:account_id/tailored_audiences/:id
  • GET accounts/:account_id/tailored_audience_changes
  • GET accounts/:account_id/tailored_audience_changes/:id
  • POST accounts/:account_id/tailored_audience_changes
  • PUT accounts/:account_id/tailored_audiences/global_opt_out

Tweet!

  • POST accounts/:account_id/tweet Beta

Mobile App Cards

  • GET accounts/:account_id/cards/app_download
  • GET accounts/:account_id/cards/app_download/:card_id
  • POST accounts/:account_id/cards/app_download
  • PUT accounts/:account_id/cards/app_download/:card_id
  • DELETE accounts/:account_id/cards/app_download/:card_id

Mobile App (Image) Cards

  • GET accounts/:account_id/cards/image_app_download
  • GET accounts/:account_id/cards/image_app_download/:card_id
  • POST accounts/:account_id/cards/image_app_download
  • PUT accounts/:account_id/cards/image_app_download/:card_id
  • DELETE accounts/:account_id/cards/image_app_download/:card_id

Lead Gen Cards

  • GET accounts/:account_id/cards/lead_gen
  • GET accounts/:account_id/cards/lead_gen/:card_id
  • POST accounts/:account_id/cards/lead_gen
  • PUT accounts/:account_id/cards/lead_gen/:card_id
  • DELETE accounts/:account_id/cards/lead_gen/:card_id

Website Cards

  • GET accounts/:account_id/cards/website
  • GET accounts/:account_id/cards/website/:card_id
  • POST accounts/:account_id/cards/website
  • PUT accounts/:account_id/cards/website/:card_id
  • DELETE accounts/:account_id/cards/website/:card_id

App Events

  • GET accounts/:account_id/app_event_provider_configurations
  • GET accounts/:account_id/app_event_provider_configurations/:id
  • GET accounts/:account_id/app_event_tags
  • GET accounts/:account_id/app_event_tags/:id

Web Events

  • GET accounts/:account_id/web_event_tags
  • GET accounts/:account_id/web_event_tags/:web_event_tag_id
  • POST accounts/:account_id/web_event_tags
  • PUT accounts/:account_id/web_event_tags/:web_event_tag_id
  • DELETE accounts/:account_id/web_event_tags/:web_event_tag_id

Scoped Timeline

  • GET accounts/:account_id/scoped_timeline

Bidding Rules

  • GET bidding_rules

Card Stats

  • GET stats/accounts/:account_id/cards/lead_gen/:card_id
  • GET stats/accounts/:account_id/cards/website/:card_id
  • GET stats/accounts/:account_id/cards/app_download/:card_id
  • GET stats/accounts/:account_id/cards/image_app_download/:card_id

Campaign Stats

  • GET stats/accounts/:account_id/campaigns/:id
  • GET stats/accounts/:account_id/campaigns

Funding Instrument Stats

  • GET stats/accounts/:account_id/funding_instruments/:id
  • GET stats/accounts/:account_id/funding_instruments

Line Item Stats

  • GET stats/accounts/:account_id/line_items/:id
  • GET stats/accounts/:account_id/line_items

Promoted Account Stats

  • GET stats/accounts/:account_id/promoted_accounts/:id
  • GET stats/accounts/:account_id/promoted_accounts

Promoted Tweets Stats

  • GET stats/accounts/:account_id/promoted_tweets/:id
  • GET stats/accounts/:account_id/promoted_tweets

Account Stats

  • GET stats/accounts/:account_id

sferik and others added 30 commits November 8, 2014 12:29
caching is also possible, but if you do choose to add it, it is highly recommended to also add `bundle update` in a `before_script` section
use --retry and --jobs to bundle install faster
Updated documentation to note that the text of a status must begin with an @-mention when replying to statuses other than those originally posted by the authenticated user.
in_reply_to_status rules clarification
@ianks
Copy link

ianks commented Jul 24, 2015

@thomas-holmes do you want help with this?

Documentation sample for segmentation shows no 'id' key being present in
the response. I've added it into the fixture data because I assume this
is an error in twitter's documentation. I cannot currently query stats
(don't know why) so I can't double check at the moment.
Unfortunately this hides the (fairly important) rate-limiting
information that is contained in the response headers.
@thomas-holmes
Copy link
Author

So I just added all of the stats endpoints though I have a few pending issues.

  1. The requests don't seem to work even though I can make requests with Twurl. I haven't gotten to the bottom of this yet.
  2. The stats endpoints are rate limited by cost on a rolling schedule. This information, as far as I know, is only available in response headers. I'm not sure where to place it. Currently I'm just shoving stats into a Twitter::Stats object, but I'm thinking maybe I should make a stats container that saves the header values and them embed the actual stat object/hashes inside of it. Thoughts?

@thomas-holmes
Copy link
Author

So I've somewhat tracked down the issue: It seems that httprb/http versions >= 8.0 change something in the way query parameters are encoded which causes a mismatch during oauth signing and validation.

The specific case I've tracked down is colons in date strings. If you supply a string with colons the signature gets generated (with colons being encoded as %3A) but when the request is made the colons are left intact as colon characters.

According to twitter's oauth documentation colons do not need to be encoded so perhaps the oauth library is incorrect?

@sferik Any intuition as to who which library is "responsible" for this problem?

@thomas-holmes
Copy link
Author

A simple interim fix seems be to just roll the http dependency back to 0.7.x

@sferik
Copy link
Owner

sferik commented Aug 13, 2015

@sferik Any intuition as to who which library is "responsible" for this problem?

I would open an issue with the http gem, referencing the Twitter percent encoding documentation and the URI RFC.

It looks like URI.escape does the right thing but URI.encode_www_form, which is used on line 129 of lib/http/client.rb in the http gem, does the wrong thing with respect to escaping colons. Reverting back to http version 0.7 isn’t a good long-term solution. If this is a bug in the http gem, let’s make sure it gets fixed there.

@ixti
Copy link

ixti commented Aug 14, 2015

Issue with escaping colon fixed in http gem (0.8.13, 0.9.1, master branch)

Also expose `#rate_limit` method on Twitter::Stats. I'm not really happy
with this method of accomplishing this but it seems good enough for now.
It seems fairly important to have the rate limit information available
while making requests to the twitter API so I'm sticking the
Twitter::RateLimit object for the request that generated it into each
created Twitter::Stats. Perhaps further consideration will indicate that
it's not necessary until the rate limit is reached.
0.8.14 Contains a fix with the encoding/normalization of query
parameters that is necessary for oauth signatures to work correctly.
The code used to work but some change (I think twitter) converted
working requests into failed requests. Apparently Content-Type of
multipart/form-data causes uploads to get rejected as 400 Bad Request.

Setting the content type to 'text/comma-separated-values' allows the
upload to work. However, this definitely needs more love. I think the
hack I put in is pretty terrible and mostly dupes the code but I don't
have time to figure out a more concise method.
@sferik sferik force-pushed the master branch 11 times, most recently from 0c18bf5 to 925baa2 Compare September 6, 2015 13:22
@stve
Copy link
Collaborator

stve commented Mar 23, 2016

@thomas-holmes Based on the discussion in #671, we've decided it makes more sense to point to Twitter's SDK. Undoubtedly your work here reflects a considerable amount of effort and while we aren't going to merge this in right now, I'd be remiss if I didn't thank you for opening this pull request and bringing this very close to the finish line. Thanks for contributing! 💯

@stve stve closed this Mar 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.