{"id":18975090,"url":"https://github.com/bufferapp/buffer-ruby-deprecated","last_synced_at":"2025-06-29T09:34:55.479Z","repository":{"id":146339802,"uuid":"5193609","full_name":"bufferapp/buffer-ruby-deprecated","owner":"bufferapp","description":"Official Ruby API wrapper for Buffer","archived":false,"fork":false,"pushed_at":"2012-07-31T06:46:15.000Z","size":130,"stargazers_count":9,"open_issues_count":0,"forks_count":11,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-03-29T10:24:55.573Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bufferapp.com/developers","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufferapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-26T15:13:10.000Z","updated_at":"2019-02-27T21:23:07.000Z","dependencies_parsed_at":"2023-03-23T23:14:52.091Z","dependency_job_id":null,"html_url":"https://github.com/bufferapp/buffer-ruby-deprecated","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fbuffer-ruby-deprecated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fbuffer-ruby-deprecated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fbuffer-ruby-deprecated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fbuffer-ruby-deprecated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufferapp","download_url":"https://codeload.github.com/bufferapp/buffer-ruby-deprecated/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249223973,"owners_count":21232844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T15:17:17.079Z","updated_at":"2025-04-16T09:34:31.991Z","avatar_url":"https://github.com/bufferapp.png","language":"Ruby","readme":"# Buffer\n\nOfficial API wrapper for [Buffer](http://bufferapp.com) covering user \u0026 profile management and adding, removing \u0026 editing updates, and more planned endpoints. See the [full API Documentation](http://bufferapp.com/developers/api/) for more.\n\nFor a Buffer OmniAuth strategy for authenticating your users with Buffer, see [omniauth-buffer2](/bufferapp/omniauth-buffer2).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'buffer'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install buffer\n\n## Usage\n\n### Client\n\nThe most basic usage of the wrapper involves creating a `Buffer::Client` and then making requests through that object. Since all requests to the Buffer API require an access token you must have first authorized a Buffer user, or otherwise have an access token. The [Buffer OmniAuth Strategy](http://github.com/bufferapp/omniauth-buffer2) can help with this.\n\nUse the Client if you just want to have full control over your `get` and `post` requests.\n\nCreating a new client is simple:\n\n```ruby\nbuffer = Buffer::Client.new access_token\n```\n\n### User\n\nThe User object makes working with users easier by providing some useful shortcuts to user information, like `id`, and data, like `profiles`. It provides the all the methods specified in the Client as it inherits from it.\n\nThe User introduces some caching of requests. These are invalidated when a `post` request is made to an endpoint that might affect the data. You can force cache invalidation of one or all endpoints using the `invalidate` method.\n\n**Note: Currently only `invalidate` is implemented. If you make a POST request that changes a user object you must manually invalidate the cache**.\n\nCreating a new user:\n\n```ruby\nuser = Buffer::User.new access_token\n```\n\n## API\n\nYou can use a client, or any subclass, to make GET \u0026 POST requests to the Buffer API. The exposed API methods are `get`, `post` and, the lowest level, `api`. \n\n#### api\n\n`api` is the method at the root of the API, handling all requests.\n\n```ruby\napi (symbol) method, (string) url, (hash, optional) params, (hash or array, optional) data\n# for example:\nbuffer.api :get, 'user'\n```\n\n`method` must be either `:get` or `:post`\n\n#### get\n\n```ruby\nuser_data = buffer.get 'user'\nuser_profiles = buffer.get 'profiles'\n```\n\n`get` is just a thin layer over `api`, so the above is equivalent to:\n\n```ruby\nuser_data = buffer.api :get, 'user'\nuser_profiles = buffer.api :get, 'profiles'\n```\n\n#### `post`\n\n```ruby\nuser_data = buffer.post 'updates/create', :text =\u003e \"Hello, world!\", :profile_ids =\u003e ['123abc456', '789def123']\n```\n\n`post` is also a wrapper for `api`, so the above becomes:\n\n```ruby\nuser_data = buffer.api :post, 'updates/create', :text =\u003e \"Hello, world!\", :profile_ids =\u003e ['123abc456', '789def123']\n```\n\n## User API\n\n#### `id`, `created_at`...\n\nThe User object allows access to the data from the user endpoint in manner of a normal ruby accessor. This makes accessing user info very easy, like the following:\n\n```ruby\nuser.id\nuser.created_at\n```\n\n#### `profiles` **not implemented**\n\n`profiles` is a helper method that gives you access to the profiles associated with a particular user. It's shorthand for `get 'profiles'` with caching. The\n\n`profiles` is invalidated by any `post` request made to a child of the `profiles` endpoing, like `/profiles/:id/schedules/update`.\n\n```ruby\nuser.profiles                 # all a user's profiles\nuser.profiles '123abc456def'  # return a profile with a specific id\n```\n\n## Todo\n\n* `user.profiles`\n* Automatic cache invalidation after post request\n* Move cache handling to a mixin","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fbuffer-ruby-deprecated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufferapp%2Fbuffer-ruby-deprecated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fbuffer-ruby-deprecated/lists"}