You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modelled after Octokit <3. This is a lightweight client for the Buffer API(https://buffer.com/developers/api), which is intended to return JSON as opposed to objects.
3
+
Modelled after [Octokit](https://github.com/octokit/octokit.rb) <3, this is a lightweight client for the [Buffer API](https://buffer.com/developers/api), which is intended to return (mostly) JSON as opposed to objects.
@@ -45,39 +44,39 @@ You can define the client up front or configure it later. The options array the
45
44
buffer_client =BufferClient.new({
46
45
:user_code => "yourcode"
47
46
})
48
-
```
49
47
50
-
```ruby
51
-
buffer_client =BufferClient.new
48
+
auth_tok = buffer_client.get_auth_token
52
49
53
50
buffer_client.configure({
54
-
:user_code => "yourcode"
51
+
:auth_token => auth_tok
55
52
})
56
53
```
57
54
58
55
### Available Calls
59
-
| Client call | Input | Description | Notes
60
-
| :---------: | :------ | :---- | :---------
61
-
| get_auth_token || Returns the user's long-lasting auth token | user_code must be defined in the buffer_client, as well as the ENV variables "BUFFER_KEY" and "BUFFER_SECRET" |
62
-
| get_user_id || Returns the user's Buffer ID ||
63
-
| get_user_json || Returns the entirety of the user JSON ||
64
-
| get_user_profiles || Returns the entirety of the profile JSON ||
65
-
| get_user_profile | Profile ID | Get a single profile as JSON by ID ||
66
-
| get_schedule | Profile ID | Get the schedule of a profile as JSON by ID ||
67
-
| update_schedule | Profile ID, Schedule Hash | Set the schedule of a profile as JSON by ID | auth_token must be defined in the buffer client. See below for schedule representation |
68
-
| get_update | Social Media Post ID | Gets an update by post ID ||
69
-
| get_pending_updates | Profile ID, Options Hash (optional) | Gets pending updates as JSON by profile ID | Takes in hash of options, see Buffer API docs for optional parameters |
70
-
| get_sent_updates | Profile ID, Options Hash (optional) | Gets sent updates as JSON by profile ID | Takes in hash of options, see Buffer API docs for optional parameters |
71
-
| get_interactions | Social Media Post ID, Event, Options Hash (optional) | Gets interactions based on event type (see https://bufferapp.com/developers/api/info#configuration)| Takes in a hash of options, see Buffer API docs for optional parameters |
72
-
| reorder_updates | Profile ID, Updates Array, Options Hash (optional) | Updates order of updates in a profile based on updates array ||
73
-
| shuffle_updates | Profile ID, Options Hash (optional) | Randomize the order of updates to be sent ||
74
-
| create_update | Profile ID Array, Options Hash (optional) | Create a new post | Note that for the "media" option, please specify each media option in the hash separately, e.g. ```{ "media[link]" => "http%3A%2F%2Fgoogle.com", "media[description]" => "The%20google%20homepage" }```|
75
-
| update_status | Social Media Post ID, Text, Options Hash (optional) | Update an existing status | For the "media" option see the note on create_update |
76
-
| share_update | Social Media Post ID | Share a post immediately ||
77
-
| destroy_update | Social Media Post ID| Permanently destroy an update ||
78
-
| move_to_top | Social Media Post ID| Move post to top of queue ||
79
-
| get_shares | URL (unencoded) | Gets the number of shares for a given URL through Buffer | You can pass a normal URL here, the client will encode it. This is one of the only calls to not require an auth_token |
80
-
| get_configuration || Gets the current Buffer config ||
56
+
57
+
| Client call | Input | Output | Notes
58
+
| :---------: | :------ | :------ | :---------
59
+
|[get_auth_token](https://buffer.com/developers/api/oauth)|| Auth Token:String| ENV variables "BUFFER_KEY" and "BUFFER_SECRET" must be defined here |
60
+
| get_user_id || ID:String| Convenience wrapper, calls get_user_json under the hood |
|[update_schedule](https://buffer.com/developers/api/profiles#schedulesupdate)| Profile ID:String, Schedule:Hash| Success:Boolean| See below for schedule representation |
67
+
|[get_update](https://buffer.com/developers/api/updates#updatesid)| Social Media Post ID:String| Update:Hash||
68
+
|[get_pending_updates](https://buffer.com/developers/api/updates#updatespending)| Profile ID:String, Options:Hash (optional) | UpdateResult:Hash| See Buffer API doc (link to the left) for optional parameters. "updates" key contains the Updates:Array<Hash> |
69
+
|[get_sent_updates](https://buffer.com/developers/api/updates#updatessent)| Profile ID:String, Options:Hash (optional) | UpdateResult:Hash| See Buffer API doc (link to the left) for optional parameters. "updates" key contains the Updates:Array<Hash> |
70
+
|[get_interactions](https://buffer.com/developers/api/updates#updatesinteractions)| Social Media Post ID:String, Event:ENUM, Options:Hash (optional) | Interactions:Hash| See [event types](https://bufferapp.com/developers/api/info#configuration) for possible event values and Buffer API doc (link to the left) for optional parameters. "interactions" key contains the Interactions:Array<Hash> |
|[create_update](https://buffer.com/developers/api/updates#updatescreate)| Profile IDs:Array, Options:Hash (optional) | Update:Hash| Note that for the "media" option, please specify each media option in the hash separately, e.g. ```{ "media[link]" => "http%3A%2F%2Fgoogle.com", "media[description]" => "The%20google%20homepage" }```. See all available options in the Buffer docs (link to the left) |
74
+
|[update_status](https://buffer.com/developers/api/updates#updatesupdate)| Social Media Post ID:String, Text:String, Options:Hash (optional) | Update:Hash| For the "media" option see the note on create_update above |
75
+
|[share_update](https://buffer.com/developers/api/updates#updatesshare)| Social Media Post ID:String| Success:Boolean||
76
+
|[destroy_update](https://buffer.com/developers/api/updates#updatesdestroy)| Social Media Post ID:String| Success:Boolean||
77
+
|[move_to_top](https://buffer.com/developers/api/updates#updatesmovetotop)| Social Media Post ID:String| Success:Boolean||
78
+
|[get_shares](https://buffer.com/developers/api/links#shares)| Unencodded URL:String| Shares:Integer| You can pass a normal URL here, the client will encode it. This is one of the only calls to not require an auth_token |
79
+
|[get_configuration](https://buffer.com/developers/api/info#configuration)|| Configuration:Hash| "services" key has internal keys for each service |
81
80
82
81
### Helper methods
83
82
| Method | Description |
@@ -104,20 +103,21 @@ To update a schedule the BufferClient is expecting a schedule of the form:
104
103
]
105
104
```
106
105
106
+
Note that you can make the keys symbols or strings, the client will accept either one.
107
107
## Contributing
108
108
109
109
To contribute simply:
110
110
111
111
1. Fork this project
112
112
2. Make your changes in a new branch
113
113
3. Create a PR
114
-
4. Once approved squash your commits(http://davidwalsh.name/squash-commits-git)
114
+
4. Once approved [squash your commits](http://davidwalsh.name/squash-commits-git)
0 commit comments