# Ruby SDK [View original](https://ittybit.cloud/sdks/ruby) ## Installation ```bash $ gem install ittybit ``` *** ## Usage Instantiate and use the client with the following: ```ruby require 'ittybit' ittybit = Ittybit::Client.new( api_key: "ITTYBIT_API_KEY", ) ``` Then you can use the client to make requests to the API. ```ruby files = ittybit.files.list() puts files ``` *** ### Async Usage The SDK also provides async clients for non-blocking operations: ```ruby require 'ittybit' require 'async' Async do ittybit = Ittybit::AsyncClient.new( api_key: "ITTYBIT_API_KEY", ) files = ittybit.files.list() puts files end ``` *** ## Advanced Features ### Request Options You can customize individual requests with additional options: ```ruby # Custom timeout ittybit.media.create( title: "My Video", request_options: Ittybit::RequestOptions.new( timeout_in_seconds: 30 ) ) ``` *** ### Error Handling The SDK raises exceptions for API errors: ```ruby begin file = ittybit.files.get(id: "non_existent_id") puts file rescue Ittybit::Error => e puts "Error: #{e.message}" puts "Status code: #{e.status_code}" puts "Response body: #{e.body}" end ```