{"id":15033070,"url":"https://github.com/danielpclark/trav3","last_synced_at":"2025-04-10T00:23:25.202Z","repository":{"id":59157986,"uuid":"165383423","full_name":"danielpclark/trav3","owner":"danielpclark","description":"A feature complete API client for Travis CI API Version 3","archived":false,"fork":false,"pushed_at":"2021-02-25T15:39:40.000Z","size":343,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T02:07:00.082Z","etag":null,"topics":["api","api-client","api-wrapper","ruby","ruby-gem","travis-ci","travisci"],"latest_commit_sha":null,"homepage":"","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/danielpclark.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":"2019-01-12T12:04:43.000Z","updated_at":"2021-02-25T15:39:42.000Z","dependencies_parsed_at":"2022-09-13T20:11:27.495Z","dependency_job_id":null,"html_url":"https://github.com/danielpclark/trav3","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Ftrav3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Ftrav3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Ftrav3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Ftrav3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielpclark","download_url":"https://codeload.github.com/danielpclark/trav3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248132374,"owners_count":21053028,"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":["api","api-client","api-wrapper","ruby","ruby-gem","travis-ci","travisci"],"created_at":"2024-09-24T20:20:00.996Z","updated_at":"2025-04-10T00:23:25.172Z","avatar_url":"https://github.com/danielpclark.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/trav3.svg)](http://badge.fury.io/rb/trav3)\n[![Build Status](https://travis-ci.org/danielpclark/trav3.svg?branch=master)](https://travis-ci.org/danielpclark/trav3)\n[![Maintainability](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/maintainability)](https://codeclimate.com/github/danielpclark/trav3/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/test_coverage)](https://codeclimate.com/github/danielpclark/trav3/test_coverage)\n[![Red The Docs](https://img.shields.io/badge/Read-the%20docs-blue.svg)](http://danielpclark.github.io/trav3/Trav3/Travis.html)\n[![Feature Complete](https://img.shields.io/badge/Feature-Complete-brightgreen.svg)](https://saythanks.io/to/danielpclark)\n\n# Trav3\n\nA simple abstraction layer for Travis CI API v3.\n\nThe benefits of this library over the official gem are:\n\n* No gem dependencies\n* Designed much like the API documentation\n* Handling the returned data is the same for nearly every response\n* Little to no learning curve\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'trav3', '~\u003e 1.0.0'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install trav3\n\n## Usage\n\nYou can get started with the following.\n\n```ruby\nrequire 'trav3'\nproject = Trav3::Travis.new(\"name/example\")\n```\n\nWhen you instantiate an instance of [Trav3::Travis](http://danielpclark.github.io/trav3/Trav3/Travis.html)\nyou get some default headers and default options.\n\n#### Default Options\n\n* `limit: 25` — for limiting data queries to 25 items at most\n\nOptions can be changed via the `#options` getter method which will give you a\n[Trav3::Options](http://danielpclark.github.io/trav3/Trav3/Options.html) instance.\nAll changes to it affect the options that the `Trav3::Travis` instance will submit\nin url requests.\n\n#### Default Headers\n\n* `'Content-Type': 'application/json'`\n* `'Accept': 'application/json'`\n* `'Travis-API-Version': 3`\n\nHeaders can be changed via the `#headers` getter method which will give you a\n[Trav3::Headers](http://danielpclark.github.io/trav3/Trav3/Headers.html) instance.\nAll changes to it affect the headers that the `Trav3::Travis` instance will submit\nin url requests.\n\n## API\n\nThe client has the full API implemented.  Here are the methods.\n\n| | | |\n|-----|-----|-----|\n| [`#active`](http://danielpclark.github.io/trav3/Trav3/Travis.html#active-instance_method) | [`#beta_feature`](http://danielpclark.github.io/trav3/Trav3/Travis.html#beta_feature-instance_method) | [`#beta_features`](http://danielpclark.github.io/trav3/Trav3/Travis.html#beta_features-instance_method) |\n| [`#branch`](http://danielpclark.github.io/trav3/Trav3/Travis.html#branch-instance_method) | [`#branches`](http://danielpclark.github.io/trav3/Trav3/Travis.html#branches-instance_method) | [`#broadcasts`](http://danielpclark.github.io/trav3/Trav3/Travis.html#broadcasts-instance_method) |\n| [`#build`](http://danielpclark.github.io/trav3/Trav3/Travis.html#build-instance_method) | [`#builds`](http://danielpclark.github.io/trav3/Trav3/Travis.html#builds-instance_method) | [`#build_jobs`](http://danielpclark.github.io/trav3/Trav3/Travis.html#build_jobs-instance_method) |\n| [`#caches`](http://danielpclark.github.io/trav3/Trav3/Travis.html#caches-instance_method) | [`#cron`](http://danielpclark.github.io/trav3/Trav3/Travis.html#cron-instance_method) | [`#crons`](http://danielpclark.github.io/trav3/Trav3/Travis.html#crons-instance_method) |\n| [`#email_resubscribe`](http://danielpclark.github.io/trav3/Trav3/Travis.html#email_resubscribe-instance_method) | [`#email_unsubscribe`](http://danielpclark.github.io/trav3/Trav3/Travis.html#email_unsubscribe-instance_method) | [`#env_var`](http://danielpclark.github.io/trav3/Trav3/Travis.html#env_var-instance_method) |\n| [`#env_vars`](http://danielpclark.github.io/trav3/Trav3/Travis.html#env_vars-instance_method) | [`#installation`](http://danielpclark.github.io/trav3/Trav3/Travis.html#installation-instance_method) | [`#job`](http://danielpclark.github.io/trav3/Trav3/Travis.html#job-instance_method) |\n| [`#key_pair`](http://danielpclark.github.io/trav3/Trav3/Travis.html#key_pair-instance_method) | [`#key_pair_generated`](http://danielpclark.github.io/trav3/Trav3/Travis.html#key_pair_generated-instance_method) | [`#lint`](http://danielpclark.github.io/trav3/Trav3/Travis.html#lint-instance_method) |\n| [`#log`](http://danielpclark.github.io/trav3/Trav3/Travis.html#log-instance_method) | [`#messages`](http://danielpclark.github.io/trav3/Trav3/Travis.html#messages-instance_method) | [`#organization`](http://danielpclark.github.io/trav3/Trav3/Travis.html#organization-instance_method) |\n| [`#organizations`](http://danielpclark.github.io/trav3/Trav3/Travis.html#organizations-instance_method) | [`#owner`](http://danielpclark.github.io/trav3/Trav3/Travis.html#owner-instance_method) | [`#preference`](http://danielpclark.github.io/trav3/Trav3/Travis.html#preference-instance_method) |\n| [`#preferences`](http://danielpclark.github.io/trav3/Trav3/Travis.html#preferences-instance_method) | [`#repositories`](http://danielpclark.github.io/trav3/Trav3/Travis.html#repositories-instance_method) | [`#repository`](http://danielpclark.github.io/trav3/Trav3/Travis.html#repository-instance_method) |\n| [`#request`](http://danielpclark.github.io/trav3/Trav3/Travis.html#request-instance_method) | [`#requests`](http://danielpclark.github.io/trav3/Trav3/Travis.html#requests-instance_method) | [`#stages`](http://danielpclark.github.io/trav3/Trav3/Travis.html#stages-instance_method) |\n| [`#setting`](http://danielpclark.github.io/trav3/Trav3/Travis.html#setting-instance_method) | [`#settings`](http://danielpclark.github.io/trav3/Trav3/Travis.html#settings-instance_method) | [`#user`](http://danielpclark.github.io/trav3/Trav3/Travis.html#user-instance_method) |\n\n\n**General Usage**\n\n```ruby\nproject.owner\nproject.owner(\"owner\")\nproject.repositories\nproject.repositories(\"owner\")\nproject.repository\nproject.repository(\"owner/repo\")\nproject.builds\nproject.build(12345)\nproject.build_jobs(12345)\nproject.job(1234)\nproject.log(1234)\n\n# API Request Options\nproject.options.build({limit: 25})\n\n# Pagination\nbuilds = project.builds\nbuilds.page.next\nbuilds.page.first\nbuilds.page.last\n\n# Recommended inspection\nbuilds.keys\nbuilds.dig(\"some_key\")\n\n# Follow `@href`\nrepositories = project.repositories(\"owner\")['repositories']\nrepositories.first.follow\n```\n\n## Response\n\nThe results from queries return either `Success` or `RequestError` which both repsond with Hash like query methods for the JSON data or the Net::HTTP resonse object methods.\n\nThe `Response` classes `Success` and `RequestError` forward method calls for all of the instance methods of a `ResponseCollection` to the collection.  And for the actual Net::HTTP response the following methods are forwarded from these classes to it:\n\n* `#code`\n* `#code_type`\n* `#uri`\n* `#message`\n* `#read_header`\n* `#header`\n* `#value`\n* `#entity`\n* `#response`\n* `#body`\n* `#decode_content`\n* `#msg`\n* `#reading_body`\n* `#read_body`\n* `#http_version`\n* `#connection_close?`\n* `#connection_keep_alive?`\n* `#initialize_http_header`\n* `#get_fields`\n* `#each_header`\n\nThe keys for the response are displayed with `#inspect` along with the object.  Opening up any of the items from its key will produce a [`ResponseCollection`](http://danielpclark.github.io/trav3/Trav3/ResponseCollection.html) object that behaves like both an Array or Hash and has a method to [follow](https://github.com/danielpclark/trav3#follow) response links.\n\n`ResponseCollection` uniformly implements:\n\n* `#[]`\n* `#dig`\n* `#each`\n* `#fetch`\n* `#first`\n* `#follow`\n* `#hash?`\n* `#last`\n* `#warnings`\n\nWhich each behave as they would on the collection type per collection type, `Hash` or `Array`, with the exception of `#each`.  `#each` will wrap every item in an `Array` with another `ResponseCollection`, but if it's a `Hash` then `#each` simply works as it normally would on a `Hash`\n\n`ResponseCollection` also forwards:\n\n* `#count`\n* `#keys`\n* `#values`\n* `#has_key?`\n* `#key?`\n* `empty?`\n\nto the inner collection.\n\n## Follow\n\nEach request returns a `Response` type of either `Success` or `RequestError`.\nWhen you have an instance of `Success` each response collection of either `Hash` or `Array` will\nbe an instance of `ResponseCollection`.  If the `#hash?` method responds as `true` the `#follow`\nmethod will follow any immediate `@href` link provided in the collection.  If `#hash?` produces `false`\nthen the collection is an Array of items and you may use the index of the item you want to follow the\n`@href` with; like so `#follow(3)`.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/danielpclark/trav3.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpclark%2Ftrav3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielpclark%2Ftrav3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpclark%2Ftrav3/lists"}