---
title: "Ruby SDK"
description: "使用 TwexAPI Ruby SDK 在 Ruby 应用与脚本中进行推文搜索、粉丝导出、私信与 X 自动化。"
---

当你需要在 Ruby 应用与脚本中获得类型化请求对象、基于 Faraday 的 HTTP、重试与分页辅助的 TwexAPI REST 工作流时，请使用 Ruby SDK。

| Ruby 任务 | SDK 调用 | 保存 |
| --------- | ------------------------ | ------------ |
| 搜索推文 | `client.search.advanced` | `next_cursor` |
| 读取资料 | `client.users.get_about` | `screen_name` |
| 列出粉丝 | `client.users.followers.list` | cursor |

## 错误处理

```ruby
begin
  client.search.advanced(request: req)
rescue Models::Errors::HTTPValidationError => e
  raise e
rescue Errors::APIError => e
  puts e.status_code, e.body
end
```

## 参考

* [SDK 概览](/sdks)
* [认证](/authentication)
* [高级 Twitter 搜索](/api-reference/search-endpoints/get-data-page-twitter-advanced-search-page-post)
* [源码仓库](https://github.com/twexapi-dev/x-api-scraper-ruby)
