From 6a446c41a1e74939728f8fa3af4713daa51ad84e Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Mon, 17 Sep 2012 15:51:21 +0400 Subject: [PATCH] [refs #374] Add all jsons. Remove all unused data --- apidocs/Rules | 29 - apidocs/content/v1.md | 374 ------ apidocs/content/v1/architectures.md | 27 +- apidocs/content/v1/markdown.md | 49 - apidocs/content/v1/platforms.md | 134 +-- apidocs/content/v1/projects.md | 127 +- apidocs/content/v1/repositories.md | 38 +- apidocs/layouts/_changes.html | 6 - apidocs/layouts/_meta.html | 18 - apidocs/layouts/changes.html | 5 - apidocs/layouts/default.html | 38 +- apidocs/lib/changes_helper.rb | 89 -- apidocs/lib/default.rb | 2 +- apidocs/lib/resources.rb | 1716 +++++++++------------------ 14 files changed, 586 insertions(+), 2066 deletions(-) delete mode 100644 apidocs/content/v1.md delete mode 100644 apidocs/content/v1/markdown.md delete mode 100644 apidocs/layouts/_changes.html delete mode 100644 apidocs/layouts/_meta.html delete mode 100644 apidocs/layouts/changes.html delete mode 100644 apidocs/lib/changes_helper.rb diff --git a/apidocs/Rules b/apidocs/Rules index ed139b271..c56a0eb86 100644 --- a/apidocs/Rules +++ b/apidocs/Rules @@ -13,27 +13,6 @@ compile '/static/*' do end -compile '/CNAME/' do -end - -compile '/feed/' do - filter :erb - filter :kramdown - filter :colorize_syntax, - :colorizers => {:javascript => :pygmentsrb} -end - -%w(v3 */).each do |version| - compile "/changes/#{version}" do - filter :erb - filter :kramdown - filter :colorize_syntax, - :colorizers => {:javascript => :pygmentsrb} - layout 'changes' if version[0] == '*' - layout 'default' - end -end - compile '*' do filter :erb filter :kramdown @@ -46,14 +25,6 @@ route '/static/*' do item.identifier[7..-2] end -route '/CNAME/' do - '/CNAME' -end - -route '/feed' do - '/changes.atom' -end - route '*' do item.identifier + 'index.html' end diff --git a/apidocs/content/v1.md b/apidocs/content/v1.md deleted file mode 100644 index 3e0b86dfb..000000000 --- a/apidocs/content/v1.md +++ /dev/null @@ -1,374 +0,0 @@ ---- -title: GitHub API v3 ---- - -# API v3 - -This describes the resources that make up the official GitHub API v3. If -you have any problems or requests please contact -[support](mailto:support@github.com?subject=APIv3). - -* Schema -* Client Errors -* HTTP Verbs -* Authentication -* Pagination -* Rate Limiting -* Conditional Requests -* Cross Origin Resource Sharing -* JSON-P Callbacks - -## Schema - -All API access is over HTTPS, and accessed from the `api.github.com` -domain (or through `yourdomain.com/api/v3/` for enterprise). All data is -sent and received as JSON. - -
-$ curl -i https://api.github.com
-
-HTTP/1.1 302 Found
-Server: nginx/1.0.12
-Date: Mon, 20 Feb 2012 11:15:49 GMT
-Content-Type: text/html;charset=utf-8
-Connection: keep-alive
-Status: 302 Found
-X-RateLimit-Limit: 5000
-ETag: "d41d8cd98f00b204e9800998ecf8427e"
-Location: http://developer.github.com
-X-RateLimit-Remaining: 4999
-Content-Length: 0
-
-
- -Blank fields are included as `null` instead of being omitted. - -All timestamps are returned in ISO 8601 format: - - YYYY-MM-DDTHH:MM:SSZ - -## Client Errors - -There are three possible types of client errors on API calls that -receive request bodies: - -1. Sending invalid JSON will result in a `400 Bad Request` response. - - HTTP/1.1 400 Bad Request - Content-Length: 35 - - {"message":"Problems parsing JSON"} - -2. Sending the wrong type of JSON values will result in a `400 Bad - Request` response. - - HTTP/1.1 400 Bad Request - Content-Length: 40 - - {"message":"Body should be a JSON Hash"} - -3. Sending invalid fields will result in a `422 Unprocessable Entity` - response. - - HTTP/1.1 422 Unprocessable Entity - Content-Length: 149 - - { - "message": "Validation Failed", - "errors": [ - { - "resource": "Issue", - "field": "title", - "code": "missing_field" - } - ] - } - -All error objects have resource and field properties so that your client -can tell what the problem is. There's also an error code to let you -know what is wrong with the field. These are the possible validation error -codes: - -missing -: This means a resource does not exist. - -missing\_field -: This means a required field on a resource has not been set. - -invalid -: This means the formatting of a field is invalid. The documentation -for that resource should be able to give you more specific information. - -already\_exists -: This means another resource has the same value as this field. This -can happen in resources that must have some unique key (such as Label -names). - -If resources have custom validation errors, they will be documented with -the resource. - -## HTTP Verbs - -Where possible, API v3 strives to use appropriate HTTP verbs for each -action. - -HEAD -: Can be issued against any resource to get just the HTTP header info. - -GET -: Used for retrieving resources. - -POST -: Used for creating resources, or performing custom actions (such as -merging a pull request). - -PATCH -: Used for updating resources with partial JSON data. For instance, an -Issue resource has `title` and `body` attributes. A PATCH request may -accept one or more of the attributes to update the resource. PATCH is a -relatively new and uncommon HTTP verb, so resource endpoints also accept -POST requests. - -PUT -: Used for replacing resources or collections. For PUT requests -with no `body` attribute, be sure to set the `Content-Length` header to zero. - -DELETE -: Used for deleting resources. - -## Authentication - -There are two ways to authenticate through GitHub API v3: - -Basic Authentication: - -
-$ curl -u "username" https://api.github.com
-
- -OAuth2 Token (sent in a header): - -
-$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
-
- -OAuth2 Token (sent as a parameter): - -
-$ curl https://api.github.com/?access_token=OAUTH-TOKEN
-
- -Read [more about OAuth2](/v3/oauth/). Note that OAuth2 tokens can be [acquired -programmatically](/v3/oauth/#create-a-new-authorization), for applications that -are not websites. - -Requests that require authentication will return 404, instead of 403, in some places. -This is to prevent the accidental leakage of private repositories to unauthorized -users. - -## Pagination - -Requests that return multiple items will be paginated to 30 items by -default. You can specify further pages with the `?page` parameter. For some -resources, you can also set a custom page size up to 100 with the `?per_page` parameter. - -
-$ curl https://api.github.com/user/repos?page=2&per_page=100
-
- -The pagination info is included in [the Link -header](http://www.w3.org/Protocols/9707-link-header.html). It is important to -follow these Link header values instead of constructing your own URLs. In some -instances, such as in the [Commits -API](/v3/repos/commits/), pagination is based on -SHA1 and not on page number. - - Link: ; rel="next", - ; rel="last" - -_Linebreak is included for readability._ - -The possible `rel` values are: - -`next` -: Shows the URL of the immediate next page of results. - -`last` -: Shows the URL of the last page of results. - -`first` -: Shows the URL of the first page of results. - -`prev` -: Shows the URL of the immediate previous page of results. - -## Rate Limiting - -We limit requests to API v3 to 5000 per hour. This is keyed off either your -login, your OAuth token, or request IP. You can check the returned HTTP -headers of any API request to see your current status: - -
-$ curl -i https://api.github.com/users/whatever
-
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4966
-
- -You can also check your rate limit status without incurring an API hit. - - GET /rate_limit - -### Rate limit - -<%= headers 200 %> -<%= json :rate => {:remaining => 4999, :limit => 5000} %> - -
- -#### Unauthenticated rate limited requests - -If you need to make unauthenticated calls but need to use a higher rate limit -associated with your OAuth application, you can send over your client ID and -secret in the query string. - -
-$ curl -i https://api.github.com/users/whatever?client_id=xxxxxxxxxxxxxx&client_secret=yyyyyyyyyyyyyyyyyyyyy
-
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 12500
-X-RateLimit-Remaining: 11966
-
- -This method should only be used for server-to-server calls. You should never -share your client secret with anyone or include it in client-side browser code. - -Please [contact us](https://github.com/contact) to request white listed access -for your application. We prefer sites that setup OAuth applications for their - users. - -## Conditional Requests - -Most responses return `Last-Modified` and `Etag` headers. You can use the values -of these headers to make subsequent requests to those resources using the -`If-Modified-Since` and `If-None-Match` headers, respectively. If the resource -has not changed, the server will return a `304 Not Modified`. Also note: making -a conditional request and receiving a 304 response does not count against your -[Rate Limit](#rate-limiting), so we encourage you to use it whenever possible. - -
-$ curl -i https://api.github.com/user
-HTTP/1.1 200 OK
-Cache-Control: private, max-age=60
-ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 200 OK
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
-$ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
-HTTP/1.1 304 Not Modified
-Cache-Control: private, max-age=60
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 304 Not Modified
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
-$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
-HTTP/1.1 304 Not Modified
-Cache-Control: private, max-age=60
-ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
-Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
-Status: 304 Not Modified
-Vary: Accept, Authorization, Cookie
-X-RateLimit-Limit: 5000
-X-RateLimit-Remaining: 4996
-
- -## Cross Origin Resource Sharing - -The API supports Cross Origin Resource Sharing (CORS) for AJAX requests. -you can read the [CORS W3C working draft](http://www.w3.org/TR/cors), or -[this intro](http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from the -HTML 5 Security Guide. - -Here's a sample request sent from a browser hitting -`http://some-site.com`: - - $ curl -i https://api.github.com -H "Origin: http://some-site.com" - HTTP/1.1 302 Found - -Any domain that is registered as an OAuth Application is accepted. -Here's a sample request for a browser hitting [Calendar About Nothing](http://calendaraboutnothing.com/): - - $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com" - HTTP/1.1 302 Found - Access-Control-Allow-Origin: http://calendaraboutnothing.com - Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes - Access-Control-Allow-Credentials: true - -This is what the CORS preflight request looks like: - - $ curl -i https://api.github.com -H "Origin: http://calendaraboutnothing.com" -X OPTIONS - HTTP/1.1 204 No Content - Access-Control-Allow-Origin: http://calendaraboutnothing.com - Access-Control-Allow-Headers: Authorization, X-Requested-With - Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE - Access-Control-Expose-Headers: Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes - Access-Control-Max-Age: 86400 - Access-Control-Allow-Credentials: true - -## JSON-P Callbacks - -You can send a `?callback` parameter to any GET call to have the results -wrapped in a JSON function. This is typically used when browsers want -to embed GitHub content in web pages by getting around cross domain -issues. The response includes the same data output as the regular API, -plus the relevant HTTP Header information. - -
-$ curl https://api.github.com?callback=foo
-
-foo({
-  "meta": {
-    "status": 200,
-    "X-RateLimit-Limit": "5000",
-    "X-RateLimit-Remaining": "4966",
-    "Link": [ // pagination headers and other links
-      ["https://api.github.com?page=2", {"rel": "next"}]
-    ]
-  },
-  "data": {
-    // the data
-  }
-})
-
- -You can write a javascript handler to process the callback like this: - -
function foo(response) {
-  var meta = response.meta
-  var data = response.data
-  console.log(meta)
-  console.log(data)
-}
- -All of the headers are the same String value as the HTTP Headers with one -notable exception: Link. Link headers are pre-parsed for you and come -through as an array of `[url, options]` tuples. - -A link that looks like this: - - Link: ; rel="next", ; rel="foo"; bar="baz" - -... will look like this in the Callback output: - -<%= json "Link" => [ - ["url1", {:rel => "next"}], - ["url2", {:rel => "foo", :bar => "baz"}]] %> - diff --git a/apidocs/content/v1/architectures.md b/apidocs/content/v1/architectures.md index 86267cbce..2548a51b3 100644 --- a/apidocs/content/v1/architectures.md +++ b/apidocs/content/v1/architectures.md @@ -8,30 +8,9 @@ TYPE: GET RESPONSE: -```json -{ - "architectures": [ - { - "id": , - "name": - }, - ... - ] -``` +<%= json(:architecture_list_response) %> RESPONSE EXAMPLE: -```json -{ - "architectures": [ - { - "id": 1, - "name": "x86_64" - }, - { - "id": 2, - "name": "i586" - }, - ... - ] -``` +<%= json(:architecture_list_response_example) %> + diff --git a/apidocs/content/v1/markdown.md b/apidocs/content/v1/markdown.md deleted file mode 100644 index eadf2f2f7..000000000 --- a/apidocs/content/v1/markdown.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: Markdown Rendering | GitHub API ---- - -# Markdown Rendering API - -## Render an arbitrary Markdown document - - POST /markdown - -### Input - -text -: _Required_ **string** - The Markdown text to render - -mode -: _Optional_ **string** - The rendering mode - - - `markdown` to render a document as plain Markdown, just like README files are rendered. - - `gfm` to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly. - -context -: _Optional_ **string** - The repository context, only taken into account when rendering as `gfm` - -<%= json \ - :text => "Hello world github/linguist#1 **cool**, and #1!", - :mode => "gfm", - :context => "github/gollum" -%> - -### Response - -<%= text_html \ - %(

Hello world github/linguist#1 cool, and #1!

), 200 -%> - -# Render a Markdown document in raw mode - - POST /markdown/raw - -### Input - -The raw API is not JSON-based. It takes a Markdown document as plaintext (`text/plain` or `text/x-markdown`) and renders it as plain Markdown without a repository context (just like a README.md file is rendered -- this is the simplest way to preview a readme online). - -### Response - -<%= text_html \ - %(

Hello world github/linguist#1 cool, and #1!

), 200 -%> diff --git a/apidocs/content/v1/platforms.md b/apidocs/content/v1/platforms.md index 4c314c29d..5c7ff2f82 100644 --- a/apidocs/content/v1/platforms.md +++ b/apidocs/content/v1/platforms.md @@ -7,79 +7,18 @@ This request will return you all needed data about platforms list into JSON form URL: /api/v1/platforms/:id.json PARAMS: + * :id - identifier of current project TYPE: GET RESPONSE: -```json -{ - "id": , - "name": , - "description": , - "parent_platform_id": , - "created_at": , - "updated_at": , - "released": , - "visibility": , - "platform_type": , - "distrib_type": , - "owner": { - "id": , - "name": , - "type": , - "url": - }, - "repositories": [ - { - "id": , - "name": , - "url":   - } - ... - ], - "url": -} - -``` +<%= json(:platform_data_response) %> EXAMPLE: -```json -{ - "id": 1, - "name": "mdv_main", - "description": "mdv_main", - "parent_platform_id": null, - "created_at": 2012-05-09 11:26:46 UTC , - "updated_at": "2012-06-09 11:26:46 UTC ", - "released": , - "visibility": "open", - "platform_type": "main", - "distrib_type": "mdv", - "owner": { - "id":5, - "name":"Timothy Bobrov", - "type":"User", - "url":"/users/5.json" - }, - "repositories": [ - { - "id": 1, - "name": "main", - "url":  "/api/v1/repositories/1.json" - }, - { - "id": 2, - "name": "release", - "url":  "/api/v1/repositories/2.json" - } - ], - "url": "/api/v1/platforms/1.json" -} - -``` +<%= json(:platform_data_response_example) %> ### 3.2. Platform list @@ -101,73 +40,10 @@ REQUEST EXAMPLES: RESPONSE: -```json -{ - "platforms":[ - { - "id": , - "name": , - "platform_type": , - "visibility": , - "owner":{ - "id": , - "name": , - "type": , - "url": - }, - "url": - }, - ... - ] -} +<%= json(:platform_list_response) %> -``` EXAMPLE: -```json -{ - "platforms":[ - { - "id":26, - "name":"fucktest", - "platform_type":"mail", - "visibility":"hidden", - "owner":{ - "id":5, - "name":"Timothy Bobrov1", - "type":"User", - "url":"/users/5.json" - }, - "url":"/api/v1/platforms/26.json" - }, - { - "id":17, - "name":"aaa", - "platform_type":"main", - "visibility":"hidden", - "owner":{ - "id":5, - "name":"Timothy Bobrov", - "type":"User", - "url":"/timothy_bobrov.json" - }, - "url":"/api/v1/platforms/17.json" - }, - { - "id":18, - "name":"timothy_tsvetkov", - "platform_type":"main", - "visibility":"hidden", - "owner":{ - "id":4, - "name":"Yaroslav Garkin", - "type":"User", - "url":"/users/4.json" - }, - "url":"/api/v1/platforms/18.json" - }, - ],"url":"/api/v1/platforms.json" -} +<%= json(:platform_list_response_example) %> -``` diff --git a/apidocs/content/v1/projects.md b/apidocs/content/v1/projects.md index b75472491..a79ca83ad 100644 --- a/apidocs/content/v1/projects.md +++ b/apidocs/content/v1/projects.md @@ -13,97 +13,11 @@ PARAMS: RESPONSE: -```json -{ - "project": - { - "id": , - "name": , - "created_at": , - "updated_at" , - "visibility": , - "description": , - "ancestry": , - "has_issues": , - "has_wiki": , - "default_branch": , - "is_package": , - "average_build_time": , - "owner": { - "id": , - "name": , - "url": - }, - "repositories": [ - { - "id": , - "name": , - "url":  , - "platform": { - "id": , - "name": , - "url": - } - }, - .... - ], - "url": - } -} - -``` +<%= json(:project_data_response) %> EXAMPLE: -```json -{ - "project": - { - "id":4661, - "name":"hwinfo", - "created_at":"2011-09-05T14:33:25Z", - "updated_at":"2012-02-29T18:16:02Z", - "visibility":"open", - "description":"asfsafafsfasf fas fasfsa fas fasfa s", - "ancestry":null, - "has_issues":true, - "has_wiki":false, - "default_branch":"master", - "is_package":true, - "average_build_time":0, - "owner":{ - "id":4, - "name":"Yaroslav Garkin", - "type":"User", - "url":"/users/4.json" - }, - "repositories": [ - { - "id": 1, - "name": "main", - "url":  "/api/v1/repositories/1.json", - "platform": { - "id": 1, - "name": "mdv_main", - "url": "/api/v1/platforms/1.json" - } - }, - { - "id": 3, - "name": "main", - "url":  "/api/v1/repositories/3.json", - "platform": { - "id": 3, - "name": "warpc_personal", - "url": "/api/v1/platforms/3.json" - } - } - ], - }, - "url":"/api/v1/projects/4661.json"} -} - -``` +<%= json(:project_data_response_example) %> ### 1.2. Project id get by name and owner @@ -124,42 +38,9 @@ REQUEST EXAMPLES: RESPONSE: -```json -{ - "project": - { - "id": , - "name": , - "visibility": , - "owner": { - "id": , - "name": , - "url": - }, - "url": - } -} - -``` +<%= json(:project_get_id_response) %> EXAMPLE: -```json -{ - "project": - { - "id":4661, - "name":"hwinfo", - "visibility":"open", - "owner":{ - "id":4, - "name":"Yaroslav Garkin", - "type":"User", - "url":"/users/4.json" - }, - "url":"/api/v1/projects/4661.json" - } -} - -``` +<%= json(:project_get_id_response_example) %> diff --git a/apidocs/content/v1/repositories.md b/apidocs/content/v1/repositories.md index a4b048860..93a96a7ae 100644 --- a/apidocs/content/v1/repositories.md +++ b/apidocs/content/v1/repositories.md @@ -13,43 +13,9 @@ TYPE: GET RESPONSE: -```json -{ - "repository": - { - "id": , - "name": , - "created_at": , - "updated_at": , - "description": , - "platform": { - "id": , - "name": , - "url": - }, - "url": - }, - "url": -} - -``` +<%= json(:repository_data_response) %> EXAMPLE: -```json -{ - "repository": - { - "id":30, - "name":"main", - "platform":{ - "id":41, - "name":"my_personal", - "url":"/api/v1/platforms/41.json" - }, - }, - "url":"/api/v1/repositories/30.json" -} - -``` +<%= json(:repository_data_response_example) %> diff --git a/apidocs/layouts/_changes.html b/apidocs/layouts/_changes.html deleted file mode 100644 index 1afd6e7e6..000000000 --- a/apidocs/layouts/_changes.html +++ /dev/null @@ -1,6 +0,0 @@ -<% @changes.each do |article| %> -
- <%= render '_meta', :item => article %> - <%= article.compiled_content %> -
-<% end %> diff --git a/apidocs/layouts/_meta.html b/apidocs/layouts/_meta.html deleted file mode 100644 index 12ca53188..000000000 --- a/apidocs/layouts/_meta.html +++ /dev/null @@ -1,18 +0,0 @@ -

- <%= @item[:title] %> -

- -
-
- <%= gravatar_for(@item[:author_name]) %> - - <%= @item[:author_name] %> - - - <%= post_date @item %> - <% if version = @item[:api_version] %> - / Version: <%= version %> - <% end %> - -
-
diff --git a/apidocs/layouts/changes.html b/apidocs/layouts/changes.html deleted file mode 100644 index 710fd394a..000000000 --- a/apidocs/layouts/changes.html +++ /dev/null @@ -1,5 +0,0 @@ -
-<%= render '_meta', :item => @item %> - -<%= yield %> -
diff --git a/apidocs/layouts/default.html b/apidocs/layouts/default.html index 64998081b..71db60a64 100644 --- a/apidocs/layouts/default.html +++ b/apidocs/layouts/default.html @@ -19,11 +19,6 @@ @@ -37,7 +32,7 @@ @@ -64,36 +58,17 @@

GitHub Links

@@ -103,15 +78,12 @@ diff --git a/apidocs/lib/changes_helper.rb b/apidocs/lib/changes_helper.rb deleted file mode 100644 index d26a8ad57..000000000 --- a/apidocs/lib/changes_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -module ChangesHelper - MimeFormat = "application/vnd.github.%s+json".freeze - # Public: Filters the change items out. If a version is given, show only the - # items related to that version. - # - # version - Optional String version key. - # - # Returns an Array of the first 30 Nanoc::Item objects, sorted in reverse - # chronological order. - def api_changes(version = nil) - changes = @items.select { |item| item[:kind] == 'change' } - if version - version_s = version.to_s - changes.select { |item| item[:api_version] == version_s } - else - changes - end.sort! do |x, y| - attribute_to_time(y[:created_at]) <=> attribute_to_time(x[:created_at]) - end.first(30) - end - - # Public - def current_api - @current_api ||= (api_versions[-2] || api_versions.first).first - end - - # Public - def upcoming_api - @upcoming_api ||= begin - version, date = api_versions.last - version unless date - end - end - - # Public - def current_api?(version) - @api_current_checks ||= {} - if @api_current_checks.key?(version) - @api_current_checks[version] - end - - @api_current_checks[version] = version == current_api - end - - # Public - def no_current_api_versions?(*versions) - versions.none? { |v| current_api?(v) } - end - - # Public - def api_released_at(version) - @api_releases ||= {} - if @api_releases.key?(version) - @api_releases[version] - end - - @api_releases[version] = begin - pair = api_versions.detect do |(name, date)| - name == version - end - pair ? pair[1] : nil - end - end - - # Public - def api_mimetype_listing(version) - version_s = version.to_s - mime = mimetype_for version_s - if time = api_released_at(version_s) - mime << " (" - mime << "Current, " if current_api?(version_s) - mime << strftime(time) - mime << ")" - else - mime - end - end - - # Internal - def mimetype_for(version) - MimeFormat % version.to_s - end - - # Internal - def api_versions - @api_versions ||= Array(@site.config[:api_versions]) - end -end - diff --git a/apidocs/lib/default.rb b/apidocs/lib/default.rb index 1921f4637..0f108f7a1 100644 --- a/apidocs/lib/default.rb +++ b/apidocs/lib/default.rb @@ -1,3 +1,3 @@ # All files in the 'lib' directory will be loaded # before nanoc starts compiling. -include Nanoc::Helpers::Rendering, Nanoc::Helpers::Blogging, ChangesHelper +include Nanoc::Helpers::Rendering, Nanoc::Helpers::Blogging diff --git a/apidocs/lib/resources.rb b/apidocs/lib/resources.rb index 95b7a2fc5..2c72e5a30 100644 --- a/apidocs/lib/resources.rb +++ b/apidocs/lib/resources.rb @@ -88,1190 +88,606 @@ module GitHub end end -#============================================================================== -# ABF constants -#============================================================================== + #============================================================================== + # ABF constants + #============================================================================== -BUILD_LIST_SHOW_EXAMPLE = { - "build_list" => - { - "id" => 10, - "name" => "evil_tools", - "container_path" => "/rosa2012/container/evil_tools", - "status" => 6000, - "project_version" => "latest_rosa2012", - "package_version" => "latest_rosa2012", - "project" => { - "id" => 666, - "name" => "evil_tools", - "fullname" => "", - "url" => "/api/v1/projects/1" - }, - "build_for_platform" => { - "id" => 1, - "name" => "rosa2012", - "url" => "/api/v1/platforms/1" - }, - "save_to_repository" => { - "id" => 12, - "name" => "mr_evil/personal", - "url" => "/api/v1/repositories/12", - "platform" => { - "id" => 2, - "name" => "cocos_lts", - "url" => "/api/v1/platforms/2" - } - }, - "arch" => { - "id" => 1, - "name" => "x84_64" - }, - "notifed_at" => "Tue, 03 Apr 2012 14 =>06 =>10 UTC +00 =>00", - "is_circle" => false, - "update_type" => "bugfix", - "build_requires" => false, - "auto_publish" => true, - "commit_hash" => "4edafbe69632173a1800c4d7582b60b46bc1fb55", - "priority" => 0, - "duration" => nil, - "build_log_url" => "/downloads/warpc_personal/container/evil_tools-680163/log/evil_tools/build.log", - "advisory" => { - "id" => 666, - "name" => "at", - "description" => "warpc/at", - "url" => "/api/v1/advisories/666" - }, - "mass_build" => { - "id" => 666, - "name" => "rosa2012lts (main)", - "url" => "/api/v1/mass_builds/666" - }, - "owner" => { - "id" => 49, - "name" => "Mr. Evil", - "url" => "/users/49.json" - }, - "include_repos" => [ + BUILD_LIST_SHOW_EXAMPLE = { + "build_list" => { - "id" => 16, - "name" => "main", - "url" => "/api/v1/repositories/16.json", - "platform" => { - "id" => 16, - "name" => "warpc_personal", - "url" => "/api/v1/platforms/16.json" - } - } - ], - "url" => "/api/v1/build_lists/10.json" - } -} - -BUILD_LIST_SHOW_PARAMETERS = { - "build_list" => - { - "id" => "resource id", - "name" => "name", - "container_path" => "Container path", - "status" => "status code", - "project_version" => "parent project version", - "package_version" => "package version", - "project" => { - "id" => "project id", - "name" => "project name", - "fullname" => "project fullname", - "url" => "url to project data page" - }, - "build_for_platform" => { - "id" => "platform id", - "name" => "platform name", - "url" => "platform data page path" - }, - "save_to_repository" => { - "id" => "repository for package storage id", - "name" => "repository for package storage name", - "url" => "path to repository data page", - "platform" => { - "id" => "repository platform id", - "name" => "repository platform name", - "url" => "path to repository platform data page" - } - }, - "arch" => { - "id" => "build architecture id", - "name" => "build architecture name" - }, - "is_circle" => "recurrent build", - "update_type" => "update type", - "build_requires" => "build with all the required packages", - "auto_publish" => "automated publising", - "commit_hash" => "last commit hash of project source", - "priority" => "build priority", - "duration" => "build duration in seconds", - "build_log_url" => "build list log url", - "advisory" => { - "id" => "advisory id", - "name" => "advisory name", - "description" => "advisory description", - "url" => "path to advisory data page" - }, - "mass_build" => { - "id" => "mass_build id", - "name" => "mass_build name", - "url" => "path to mass_build data page" - }, - "owner" => { - "id" => "project owner id", - "name" => "project owner name", - "url" => "url to owner profile" - }, - "include_repos" => [ - { - "id" => "included repository id", - "name" => "included repository name", - "url" => "path to included repository data page", - "platform" => { - "id" => "repository platform id", - "name" => "repository platform name", - "url" => "path to repository platform data page" - } - } - ], - "url" => "url to build list page" - } -} - - -BUILD_LIST_CREATE_PARAMETERS = { - "build_list"=> { - "project_id"=> "project id", - "commit_hash"=> "commit hash to build", - "update_type"=> "one of the update types", - "save_to_repository_id"=> "repository identifier for package storage", - "build_for_platform_id"=> "platform identifier of platform for build", - "auto_publish"=> "automated publising", - "build_requires"=> "true if build with all the required packages", - "include_repos[]"=> [ - "included repository id for each selected platform" - ], - "arch_id"=> "architecture identifier" - } -} - -BUILD_LIST_CREATE_EXAMPLE = { - "build_list"=> { - "project_id"=> "10", - "commit_hash"=> "751b0cad9cd1467e735d8c3334ea3cf988995fab", - "update_type"=> "bugfix", - "save_to_repository_id"=> 12, - "build_for_platform_id"=> 2, - "auto_publish"=> true, - "build_requires"=> true, - "include_repos[]"=> [ - 54, - 53 - ], - "arch_id"=> 1 - } -} - -BUILD_LIST_CREATE_RESPONSE = { - "build_list" => - { - "id" => "build list id (null if failed)", - "message" => "success of fail message" - } -} - -BUILD_LIST_CREATE_RESPONSE_EXAMPLE = { - "build_list"=> - { - "id"=> 56, - "message"=> "Build list for project version 'beta_2012', platform 'rosa2012' and architecture 'i586' has been created successfully" - } -} - -BUILD_LIST_CANCEL_RESPONSE = { - "is_canceled"=> "true or false", - "url"=> "url to build list page", - "message"=> "success of fail message" -} - -BUILD_LIST_CANCEL_RESPONSE_EXAMPLE = { - "is_canceled"=> true, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Build canceled" -} - -BUILD_LIST_CANCEL_RESPONSE_EXAMPLE2 = { - "is_canceled"=> false, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Errors during build cancelation!" -} - -BUILD_LIST_PUBLISH_RESPONSE = { - "is_published"=> "true or false", # May be just result name will be better - "url"=> "url to build list page", - "message"=> "success of fail message" -} - -BUILD_LIST_PUBLISH_RESPONSE_EXAMPLE = { - "is_published"=> true, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Build is queued for publishing" -} - -BUILD_LIST_PUBLISH_RESPONSE_EXAMPLE2 = { - "is_published"=> false, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Errors during build publishing!" -} - -BUILD_LIST_REJECT_RESPONSE = { - "is_rejected"=> "true or false", # May be just result name will be better - "url"=> "url to build list page", - "message"=> "success or fail message" -} - -BUILD_LIST_REJECT_RESPONSE_EXAMPLE = { - "is_rejected"=> true, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Build is rejected" -} - -BUILD_LIST_REJECT_RESPONSE_EXAMPLE2 = { - "is_rejected"=> false, - "url"=> "/api/v1/build_lists/10.json", - "message"=> "Errors during build rejecting!" -} - -BUILD_LIST_SEARCH_RESPONSE = { - "build_lists"=> [ - { - "id"=> "build list id", - "name"=> "build list name", - "status"=> "build list status", - "url"=> "build list page" - } - ], - "url"=> "current url for build lists page" -} - -BUILD_LIST_SEARCH_RESPONSE_EXAMPLE = { - "build_lists"=> [ - { - "id"=> 25, - "name"=> "evil_tools", - "status"=> 6000, - "url"=> "/api/v1/build_lists/25.json" - }, - { - "id"=> 26, - "name"=> "evil_tools", - "status"=> 6000, - "url"=> "/api/v1/build_lists/26.json" - } - ], - "url"=> "/api/v1/build_lists.json" -} - -ERROR_404 = { - "status"=> 404, - "message"=> "Page not found" -} - -ERROR_500 = { - "status"=> 500, - "message"=> "Something went wrong. We've been notified about this issue and we'll take a look at it shortly." -} - -ERROR_503 = { - "status"=> 503, - "message"=> "We update the site, it will take some time. We are really trying to do it fast. We apologize for any inconvenience.." -} - -ERROR_401 = { - "status"=> 401, - "message"=> "Requires authentication" -} - -ERROR_403 = { - "message"=> "Forbidden. Sorry, you don't have enough rights for this action!" -} - -#============================================================================== -# Github constants -#============================================================================== - - USER = { - "login" => "octocat", - "id" => 1, - "avatar_url" => "https://github.com/images/error/octocat_happy.gif", - "gravatar_id" => "somehexcode", - "url" => "https://api.github.com/users/octocat" - } - - CONTRIBUTOR = USER.merge({ - "contributions" => 32 - }) - - FULL_USER = USER.merge({ - "name" => "monalisa octocat", - "company" => "GitHub", - "blog" => "https://github.com/blog", - "location" => "San Francisco", - "email" => "octocat@github.com", - "hireable" => false, - "bio" => "There once was...", - "public_repos" => 2, - "public_gists" => 1, - "followers" => 20, - "following" => 0, - "html_url" => "https://github.com/octocat", - "created_at" => "2008-01-14T04:33:35Z", - "type" => "User" - }) - - PRIVATE_USER = FULL_USER.merge({ - "total_private_repos" => 100, - "owned_private_repos" => 100, - "private_gists" => 81, - "disk_usage" => 10000, - "collaborators" => 8, - "plan" => { - "name" => "Medium", - "space" => 400, - "collaborators" => 10, - "private_repos" => 20 - } - }) - - PUBLIC_KEY = { - "url" => "https://api.github.com/user/keys/1", - "id" => 1, - "title" => "octocat@octomac", - "key" => "ssh-rsa AAA...", - } - - REPO = { - "url" => "https://api.github.com/repos/octocat/Hello-World", - "html_url" => "https://github.com/octocat/Hello-World", - "clone_url" => "https://github.com/octocat/Hello-World.git", - "git_url" => "git://github.com/octocat/Hello-World.git", - "ssh_url" => "git@github.com:octocat/Hello-World.git", - "svn_url" => "https://svn.github.com/octocat/Hello-World", - "mirror_url" => "git://git.example.com/octocat/Hello-World", - "id" => 1296269, - "owner" => USER, - "name" => "Hello-World", - "full_name" => "octocat/Hello-World", - "description" => "This your first repo!", - "homepage" => "https://github.com", - "language" => nil, - "private" => false, - "fork" => false, - "forks" => 9, - "watchers" => 80, - "size" => 108, - "master_branch" => 'master', - "open_issues" => 0, - "pushed_at" => "2011-01-26T19:06:43Z", - "created_at" => "2011-01-26T19:01:12Z", - "updated_at" => "2011-01-26T19:14:43Z" - } - - FULL_REPO = REPO.merge({ - "organization" => USER.merge('type' => 'Organization'), - "parent" => REPO, - "source" => REPO, - "has_issues" => true, - "has_wiki" => true, - "has_downloads" => true - }) - - TAG = { - "name" => "v0.1", - "commit" => { - "sha" => "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc", - "url" => "https://api.github.com/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" - }, - "zipball_url" => "https://github.com/octocat/Hello-World/zipball/v0.1", - "tarball_url" => "https://github.com/octocat/Hello-World/tarball/v0.1", - } - - BRANCHES = [ - { - "name" => "master", - "commit" => { - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" - } - } - ] - - BRANCH = {"name"=>"master", - "commit"=> - {"sha"=>"7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "commit"=> - {"author"=> - {"name"=>"The Octocat", - "date"=>"2012-03-06T15:06:50-08:00", - "email"=>"octocat@nowhere.com"}, - "url"=> - "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "message"=> - "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.", - "tree"=> - {"sha"=>"b4eecafa9be2f2006ce1b709d6857b07069b4608", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"}, - "committer"=> - {"name"=>"The Octocat", - "date"=>"2012-03-06T15:06:50-08:00", - "email"=>"octocat@nowhere.com"}}, - "author"=> - {"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974", - "avatar_url"=> - "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", - "url"=>"https://api.github.com/users/octocat", - "id"=>583231, - "login"=>"octocat"}, - "parents"=> - [{"sha"=>"553c2077f0edc3d5dc5d17262f6aa498e69d6f8e", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"}, - {"sha"=>"762941318ee16e59dabbacb1b4049eec22f0d303", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"}], - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "committer"=> - {"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974", - "avatar_url"=> - "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", - "url"=>"https://api.github.com/users/octocat", - "id"=>583231, - "login"=>"octocat"}}, - "_links"=> - {"html"=>"https://github.com/octocat/Hello-World/tree/master", - "self"=>"https://api.github.com/repos/octocat/Hello-World/branches/master"}} - - MERGE_COMMIT = {"commit"=> - {"sha"=>"7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "commit"=> - {"author"=> - {"name"=>"The Octocat", - "date"=>"2012-03-06T15:06:50-08:00", - "email"=>"octocat@nowhere.com"}, - "url"=> - "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "message"=> - "Shipped cool_feature!", - "tree"=> - {"sha"=>"b4eecafa9be2f2006ce1b709d6857b07069b4608", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"}, - "committer"=> - {"name"=>"The Octocat", - "date"=>"2012-03-06T15:06:50-08:00", - "email"=>"octocat@nowhere.com"}}, - "author"=> - {"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974", - "avatar_url"=> - "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", - "url"=>"https://api.github.com/users/octocat", - "id"=>583231, - "login"=>"octocat"}, - "parents"=> - [{"sha"=>"553c2077f0edc3d5dc5d17262f6aa498e69d6f8e", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"}, - {"sha"=>"762941318ee16e59dabbacb1b4049eec22f0d303", - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"}], - "url"=> - "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", - "committer"=> - {"gravatar_id"=>"7ad39074b0584bc555d0417ae3e7d974", - "avatar_url"=> - "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", - "url"=>"https://api.github.com/users/octocat", - "id"=>583231, - "login"=>"octocat"}}} - - MILESTONE = { - "url" => "https://api.github.com/repos/octocat/Hello-World/milestones/1", - "number" => 1, - "state" => "open", - "title" => "v1.0", - "description" => "", - "creator" => USER, - "open_issues" => 4, - "closed_issues" => 8, - "created_at" => "2011-04-10T20:09:31Z", - "due_on" => nil - } - - - PULL = { - "url" => "https://api.github.com/octocat/Hello-World/pulls/1", - "html_url" => "https://github.com/octocat/Hello-World/pulls/1", - "diff_url" => "https://github.com/octocat/Hello-World/pulls/1.diff", - "patch_url" => "https://github.com/octocat/Hello-World/pulls/1.patch", - "issue_url" => "https://github.com/octocat/Hello-World/issue/1", - "number" => 1, - "state" => "open", - "title" => "new-feature", - "body" => "Please pull these awesome changes", - "created_at" => "2011-01-26T19:01:12Z", - "updated_at" => "2011-01-26T19:01:12Z", - "closed_at" => "2011-01-26T19:01:12Z", - "merged_at" => "2011-01-26T19:01:12Z", - "head" => { - "label" => "new-topic", - "ref" => "new-topic", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "user" => USER, - "repo" => REPO, - }, - "base" => { - "label" => "master", - "ref" => "master", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "user" => USER, - "repo" => REPO, - }, - "_links" => { - "self" => {'href' => - "https://api.github.com/octocat/Hello-World/pulls/1"}, - "html" => {'href' => - "https://github.com/octocat/Hello-World/pull/1"}, - "comments" => {'href' => - "https://api.github.com/octocat/Hello-World/issues/1/comments"}, - "review_comments" => {'href' => - "https://api.github.com/octocat/Hello-World/pulls/1/comments"} - }, - "user" => USER - } - - FULL_PULL = PULL.merge({ - "merged" => false, - "mergeable" => true, - "merged_by" => USER, - "comments" => 10, - "commits" => 3, - "additions" => 100, - "deletions" => 3, - "changed_files" => 5 - }) - - COMMIT = { - "url" => "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "commit" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "author" => { - "name" => "Monalisa Octocat", - "email" => "support@github.com", - "date" => "2011-04-14T16:00:49Z", - }, - "committer" => { - "name" => "Monalisa Octocat", - "email" => "support@github.com", - "date" => "2011-04-14T16:00:49Z", - }, - "message" => "Fix all the bugs", - "tree" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - }, - }, - "author" => USER, - "committer" => USER, - "parents" => [{ - "url" => "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - }] - } - - FULL_COMMIT = COMMIT.merge({ - "stats" => { - "additions" => 104, - "deletions" => 4, - "total" => 108, - }, - "files" => [{ - "filename" => "file1.txt", - "additions" => 10, - "deletions" => 2, - "changes" => 12, - "status" => "modified", - "raw_url" => "https://github.com/octocat/Hello-World/raw/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt", - "blob_url" => "https://github.com/octocat/Hello-World/blob/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt", - "patch" => "@@ -29,7 +29,7 @@\n....." - }] - }) - - COMMIT_COMMENT = { - "html_url" => "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1", - "url" => "https://api.github.com/repos/octocat/Hello-World/comments/1", - "id" => 1, - "body" => "Great stuff", - "path" => "file1.txt", - "position" => 4, - "line" => 14, - "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "user" => USER, - "created_at" => "2011-04-14T16:00:49Z", - "updated_at" => "2011-04-14T16:00:49Z" - } - - FILE = { - "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "filename" => "file1.txt", - "status" => "added", - "additions" => 103, - "deletions" => 21, - "changes" => 124, - "blob_url" => "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", - "raw_url" => "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", - "patch" => "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" - } - - COMMIT_COMPARISON = { - "url" => "https://api.github.com/repos/octocat/Hello-World/compare/master...topic", - "html_url" => "https://github.com/octocat/Hello-World/compare/master...topic", - "permalink_url" => "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17", - "diff_url" => "https://github.com/octocat/Hello-World/compare/master...topic.diff", - "patch_url" => "https://github.com/octocat/Hello-World/compare/master...topic.patch", - "base_commit" => COMMIT, - "status" => "behind", - "ahead_by" => 1, - "behind_by" => 2, - "total_commits" => 1, - "commits" => [COMMIT], - "files" => [FILE], - } - - PULL_COMMENT = { - "url" => "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1", - "id" => 1, - "body" => "Great stuff", - "path" => "file1.txt", - "position" => 4, - "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "user" => USER, - "created_at" => "2011-04-14T16:00:49Z", - "updated_at" => "2011-04-14T16:00:49Z", - "_links" => { - "self" => {'href' => - "https://api.github.com/octocat/Hello-World/pulls/comments/1"}, - "html" => {'href' => - "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"}, - "pull_request" => {'href' => - "https://api.github.com/octocat/Hello-World/pulls/1"} - } - } - - DOWNLOAD = { - "url" => "https://api.github.com/repos/octocat/Hello-World/downloads/1", - "html_url" => "https://github.com/repos/octocat/Hello-World/downloads/new_file.jpg", - "id" => 1, - "name" => "new_file.jpg", - "description" => "Description of your download", - "size" => 1024, - "download_count" => 40, - "content_type" => ".jpg" - } - - CREATE_DOWNLOAD = DOWNLOAD.merge({ - "policy" => "ewogICAg...", - "signature" => "mwnFDC...", - "bucket" => "github", - "accesskeyid" => "1ABCDEFG...", - "path" => "downloads/ocotocat/Hello-World/new_file.jpg", - "acl" => "public-read", - "expirationdate" => "2011-04-14T16:00:49Z", - "prefix" => "downloads/octocat/Hello-World/", - "mime_type" => "image/jpeg", - "redirect" => false, - "s3_url" => "https://github.s3.amazonaws.com/" - }) - - ORG = { - "login" => "github", - "id" => 1, - "url" => "https://api.github.com/orgs/github", - "avatar_url" => "https://github.com/images/error/octocat_happy.gif" - } - - FULL_ORG = ORG.merge({ - "name" => "github", - "company" => "GitHub", - "blog" => "https://github.com/blog", - "location" => "San Francisco", - "email" => "octocat@github.com", - "public_repos" => 2, - "public_gists" => 1, - "followers" => 20, - "following" => 0, - "html_url" => "https://github.com/octocat", - "created_at" => "2008-01-14T04:33:35Z", - "type" => "Organization" - }) - - PRIVATE_ORG = FULL_ORG.merge({ - "total_private_repos" => 100, - "owned_private_repos" => 100, - "private_gists" => 81, - "disk_usage" => 10000, - "collaborators" => 8, - "billing_email" => "support@github.com", - "plan" => { - "name" => "Medium", - "space" => 400, - "private_repos" => 20 - } - }) - - TEAM = { - "url" => "https://api.github.com/teams/1", - "name" => "Owners", - "id" => 1 - } - - FULL_TEAM = TEAM.merge({ - "permission" => "admin", - "members_count" => 3, - "repos_count" => 10 - }) - - LABEL = { - "url" => "https://api.github.com/repos/octocat/Hello-World/labels/bug", - "name" => "bug", - "color" => "f29513" - } - - ISSUE = { - "url" => "https://api.github.com/repos/octocat/Hello-World/issues/1", - "html_url" => "https://github.com/octocat/Hello-World/issues/1", - "number" => 1347, - "state" => "open", - "title" => "Found a bug", - "body" => "I'm having a problem with this.", - "user" => USER, - "labels" => [LABEL], - "assignee" => USER, - "milestone" => MILESTONE, - "comments" => 0, - "pull_request" => { - "html_url" => "https://github.com/octocat/Hello-World/issues/1", - "diff_url" => "https://github.com/octocat/Hello-World/issues/1.diff", - "patch_url" => "https://github.com/octocat/Hello-World/issues/1.patch" - }, - "closed_at" => nil, - "created_at" => "2011-04-22T13:33:48Z", - "updated_at" => "2011-04-22T13:33:48Z" - } - - ISSUE_COMMENT = { - "id" => 1, - "url" => "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", - "body" => "Me too", - "user" => USER, - "created_at" => "2011-04-14T16:00:49Z", - "updated_at" => "2011-04-14T16:00:49Z" - } - - ISSUE_EVENT = { - "url" => "https://api.github.com/repos/octocat/Hello-World/issues/events/1", - "actor" => USER, - "event" => "closed", - "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", - "created_at" => "2011-04-14T16:00:49Z" - } - - FULL_ISSUE_EVENT = ISSUE_EVENT.merge('issue' => ISSUE) - - ISSUE_SEARCH_ITEM = { - "gravatar_id" => "4c3d600867886124a73f14a907b1a955", - "position" => 10, - "number" => 10, - "votes" => 2, - "created_at" => "2010-06-04T23:20:33-07:00", - "comments" => 5, - "body" => "Issue body goes here", - "title" => "This is is the issue title", - "updated_at" => "2010-06-04T23:20:33-07:00", - "html_url" => "https://github.com/pengwynn/linkedin/issues/10", - "user" => "ckarbass", - "labels" => [ - "api", - "feature request", - "investigation" - ], - "state" => "open" - } - - ISSUE_SEARCH_RESULTS = { - "issues" => [ISSUE_SEARCH_ITEM] - } - - REPO_SEARCH_ITEM = { - "type" => "repo", - "created" => "2011-09-05T11:07:54-07:00", - "watchers" => 2913, - "has_downloads" => true, - "username" => "mathiasbynens", - "homepage" => "http://mths.be/dotfiles", - "url" => "https://github.com/mathiasbynens/dotfiles", - "fork" => false, - "has_issues" => true, - "has_wiki" => false, - "forks" => 520, - "size" => 192, - "private" => false, - "followers" => 2913, - "name" => "dotfiles", - "owner" => "mathiasbynens", - "open_issues" => 12, - "pushed_at" => "2012-06-05T03:37:13-07:00", - "score" => 3.289718, - "pushed" => "2012-06-05T03:37:13-07:00", - "description" => "sensible hacker defaults for OS X", - "language" => "VimL", - "created_at" => "2011-09-05T11:07:54-07:00" - } - - REPO_SEARCH_RESULTS = { - "repositories" => [REPO_SEARCH_ITEM] - } - - USER_SEARCH_ITEM = { - "gravatar_id" => "70889091349f7598bce9afa588034310", - "name" => "Hirotaka Kawata", - "created_at" => "2009-10-05T01:32:06Z", - "location" => "Tsukuba, Ibaraki, Japan", - "public_repo_count" => 8, - "followers" => 10, - "language" => "Python", - "fullname" => "Hirotaka Kawata", - "username" => "techno", - "id" => "user-135050", - "repos" => 8, - "type" => "user", - "followers_count" => 10, - "pushed" => "2012-04-18T02:15:17.511Z", - "login" => "techno", - "score" => 4.2559967, - "record" => nil, - "created" => "2009-10-05T01:32:06Z" - } - - USER_SEARCH_RESULTS = { - "users" => [USER_SEARCH_ITEM] - } - - EMAIL_SEARCH_RESULTS = { - "user" => USER_SEARCH_ITEM - } - - GIST_HISTORY = { - "history" => [ - { - "url" => "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f", - "version" => "57a7f021a713b1c5a6a199b54cc514735d2d462f", - "user" => USER, - "change_status" => { - "deletions" => 0, - "additions" => 180, - "total" => 180 + "id" => 10, + "name" => "evil_tools", + "container_path" => "/rosa2012/container/evil_tools", + "status" => 6000, + "project_version" => "latest_rosa2012", + "package_version" => "latest_rosa2012", + "project" => { + "id" => 666, + "name" => "evil_tools", + "fullname" => "", + "url" => "/api/v1/projects/1" }, - "committed_at" => "2010-04-14T02:15:15Z" + "build_for_platform" => { + "id" => 1, + "name" => "rosa2012", + "url" => "/api/v1/platforms/1" + }, + "save_to_repository" => { + "id" => 12, + "name" => "mr_evil/personal", + "url" => "/api/v1/repositories/12", + "platform" => { + "id" => 2, + "name" => "cocos_lts", + "url" => "/api/v1/platforms/2" + } + }, + "arch" => { + "id" => 1, + "name" => "x84_64" + }, + "notifed_at" => "Tue, 03 Apr 2012 14 =>06 =>10 UTC +00 =>00", + "is_circle" => false, + "update_type" => "bugfix", + "build_requires" => false, + "auto_publish" => true, + "commit_hash" => "4edafbe69632173a1800c4d7582b60b46bc1fb55", + "priority" => 0, + "duration" => nil, + "build_log_url" => "/downloads/warpc_personal/container/evil_tools-680163/log/evil_tools/build.log", + "advisory" => { + "id" => 666, + "name" => "at", + "description" => "warpc/at", + "url" => "/api/v1/advisories/666" + }, + "mass_build" => { + "id" => 666, + "name" => "rosa2012lts (main)", + "url" => "/api/v1/mass_builds/666" + }, + "owner" => { + "id" => 49, + "name" => "Mr. Evil", + "url" => "/users/49.json" + }, + "include_repos" => [ + { + "id" => 16, + "name" => "main", + "url" => "/api/v1/repositories/16.json", + "platform" => { + "id" => 16, + "name" => "warpc_personal", + "url" => "/api/v1/platforms/16.json" + } + } + ], + "url" => "/api/v1/build_lists/10.json" } - ] } - GIST_FORKS = { - "forks" => [ + BUILD_LIST_SHOW_PARAMETERS = { + "build_list" => { - "user" => USER, - "url" => "https://api.github.com/gists/5", - "created_at" => "2011-04-14T16:00:49Z" + "id" => "resource id", + "name" => "name", + "container_path" => "Container path", + "status" => "status code", + "project_version" => "parent project version", + "package_version" => "package version", + "project" => { + "id" => "project id", + "name" => "project name", + "fullname" => "project fullname", + "url" => "url to project data page" + }, + "build_for_platform" => { + "id" => "platform id", + "name" => "platform name", + "url" => "platform data page path" + }, + "save_to_repository" => { + "id" => "repository for package storage id", + "name" => "repository for package storage name", + "url" => "path to repository data page", + "platform" => { + "id" => "repository platform id", + "name" => "repository platform name", + "url" => "path to repository platform data page" + } + }, + "arch" => { + "id" => "build architecture id", + "name" => "build architecture name" + }, + "is_circle" => "recurrent build", + "update_type" => "update type", + "build_requires" => "build with all the required packages", + "auto_publish" => "automated publising", + "commit_hash" => "last commit hash of project source", + "priority" => "build priority", + "duration" => "build duration in seconds", + "build_log_url" => "build list log url", + "advisory" => { + "id" => "advisory id", + "name" => "advisory name", + "description" => "advisory description", + "url" => "path to advisory data page" + }, + "mass_build" => { + "id" => "mass_build id", + "name" => "mass_build name", + "url" => "path to mass_build data page" + }, + "owner" => { + "id" => "project owner id", + "name" => "project owner name", + "url" => "url to owner profile" + }, + "include_repos" => [ + { + "id" => "included repository id", + "name" => "included repository name", + "url" => "path to included repository data page", + "platform" => { + "id" => "repository platform id", + "name" => "repository platform name", + "url" => "path to repository platform data page" + } + } + ], + "url" => "url to build list page" } - ] } - GIST_FILES = { - "files" => { - "ring.erl" => { - "size" => 932, - "filename" => "ring.erl", - "raw_url" => "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl" - } + + BUILD_LIST_CREATE_PARAMETERS = { + "build_list"=> { + "project_id"=> "project id", + "commit_hash"=> "commit hash to build", + "update_type"=> "one of the update types", + "save_to_repository_id"=> "repository identifier for package storage", + "build_for_platform_id"=> "platform identifier of platform for build", + "auto_publish"=> "automated publising", + "build_requires"=> "true if build with all the required packages", + "include_repos[]"=> [ + "included repository id for each selected platform" + ], + "arch_id"=> "architecture identifier" } } - GIST = { - "url" => "https://api.github.com/gists/1", - "id" => "1", - "description" => "description of gist", - "public" => true, - "user" => USER, - "files" => GIST_FILES, - "comments" => 0, - "html_url" => "https://gist.github.com/1", - "git_pull_url" => "git://gist.github.com/1.git", - "git_push_url" => "git@gist.github.com:1.git", - "created_at" => "2010-04-14T02:15:15Z" - }.update(GIST_FILES) - - FULL_GIST = GIST.merge(GIST_FORKS).merge(GIST_HISTORY) - FULL_GIST['files']['ring.erl']['content'] = 'contents of gist' - - GIST_COMMENT = { - "id" => 1, - "url" => "https://api.github.com/gists/comments/1", - "body" => "Just commenting for the sake of commenting", - "user" => USER, - "created_at" => "2011-04-18T23:23:56Z" + BUILD_LIST_CREATE_EXAMPLE = { + "build_list"=> { + "project_id"=> "10", + "commit_hash"=> "751b0cad9cd1467e735d8c3334ea3cf988995fab", + "update_type"=> "bugfix", + "save_to_repository_id"=> 12, + "build_for_platform_id"=> 2, + "auto_publish"=> true, + "build_requires"=> true, + "include_repos[]"=> [ + 54, + 53 + ], + "arch_id"=> 1 + } } - TREE = { - "sha" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", - "url" => "https://api.github.com/repo/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312", - "tree" => [ - { "path" => "file.rb", - "mode" => "100644", - "type" => "blob", - "size" => 30, - "sha" => "44b4fc6d56897b048c772eb4087f854f46256132", - "url" => "https://api.github.com/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132", + BUILD_LIST_CREATE_RESPONSE = { + "build_list" => + { + "id" => "build list id (null if failed)", + "message" => "success of fail message" + } + } + + BUILD_LIST_CREATE_RESPONSE_EXAMPLE = { + "build_list"=> + { + "id"=> 56, + "message"=> "Build list for project version 'beta_2012', platform 'rosa2012' and architecture 'i586' has been created successfully" + } + } + + BUILD_LIST_CANCEL_RESPONSE = { + "is_canceled"=> "true or false", + "url"=> "url to build list page", + "message"=> "success of fail message" + } + + BUILD_LIST_CANCEL_RESPONSE_EXAMPLE = { + "is_canceled"=> true, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Build canceled" + } + + BUILD_LIST_CANCEL_RESPONSE_EXAMPLE2 = { + "is_canceled"=> false, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Errors during build cancelation!" + } + + BUILD_LIST_PUBLISH_RESPONSE = { + "is_published"=> "true or false", # May be just result name will be better + "url"=> "url to build list page", + "message"=> "success of fail message" + } + + BUILD_LIST_PUBLISH_RESPONSE_EXAMPLE = { + "is_published"=> true, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Build is queued for publishing" + } + + BUILD_LIST_PUBLISH_RESPONSE_EXAMPLE2 = { + "is_published"=> false, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Errors during build publishing!" + } + + BUILD_LIST_REJECT_RESPONSE = { + "is_rejected"=> "true or false", # May be just result name will be better + "url"=> "url to build list page", + "message"=> "success or fail message" + } + + BUILD_LIST_REJECT_RESPONSE_EXAMPLE = { + "is_rejected"=> true, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Build is rejected" + } + + BUILD_LIST_REJECT_RESPONSE_EXAMPLE2 = { + "is_rejected"=> false, + "url"=> "/api/v1/build_lists/10.json", + "message"=> "Errors during build rejecting!" + } + + BUILD_LIST_SEARCH_RESPONSE = { + "build_lists"=> [ + { + "id"=> "build list id", + "name"=> "build list name", + "status"=> "build list status", + "url"=> "build list page" + } + ], + "url"=> "current url for build lists page" + } + + BUILD_LIST_SEARCH_RESPONSE_EXAMPLE = { + "build_lists"=> [ + { + "id"=> 25, + "name"=> "evil_tools", + "status"=> 6000, + "url"=> "/api/v1/build_lists/25.json" }, - { "path" => "subdir", - "mode" => "040000", - "type" => "tree", - "sha" => "f484d249c660418515fb01c2b9662073663c242e", - "url" => "https://api.github.com/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e" + { + "id"=> 26, + "name"=> "evil_tools", + "status"=> 6000, + "url"=> "/api/v1/build_lists/26.json" + } + ], + "url"=> "/api/v1/build_lists.json" + } + + ERROR_404 = { + "status"=> 404, + "message"=> "Page not found" + } + + ERROR_500 = { + "status"=> 500, + "message"=> "Something went wrong. We've been notified about this issue and we'll take a look at it shortly." + } + + ERROR_503 = { + "status"=> 503, + "message"=> "We update the site, it will take some time. We are really trying to do it fast. We apologize for any inconvenience.." + } + + ERROR_401 = { + "status"=> 401, + "message"=> "Requires authentication" + } + + ERROR_403 = { + "message"=> "Forbidden. Sorry, you don't have enough rights for this action!" + } + + PROJECT_DATA_RESPONSE = { + "project"=> + { + "id" => "resource id", + "name" => "name", + "created_at" => "created at date and time", + "updated_at" => "updated at date and time", + "visibility" => "visibility (open/hidden)", + "description" => "description", + "ancestry" => "project ancestry", + "has_issues" => "true if issues enabled", + "has_wiki" => "true if wiki enabled", + "default_branch" => "git branch used by default", + "is_package" => "true if project is package", + "average_build_time" => "average build time for this project", + "owner" => { + "id" => "parent owner id", + "name" => "parent owner name", + "url" => "url to owner profile" + }, + "repositories" => [ + { + "id" => "repository for package storage id", + "name" => "repository for package storage name", + "url" => "path to repository data page", + "platform" => { + "id" => "repository platform id", + "name" => "repository platform name", + "url" => "path to repository platform data page" + } + } + ], + "url" => "url to build list page" + } + } + + PROJECT_DATA_RESPONSE_EXAMPLE = { + "project" => + { + "id" => 4661, + "name" => "hwinfo", + "created_at" => "2011-09-05T14 =>33 =>25Z", + "updated_at" => "2012-02-29T18 =>16 =>02Z", + "visibility" => "open", + "description" => "asfsafafsfasf fas fasfsa fas fasfa s", + "ancestry" => nil, + "has_issues" => true, + "has_wiki" => false, + "default_branch" => "master", + "is_package" => true, + "average_build_time" => 0, + "owner" => { + "id" => 4, + "name" => "Yaroslav Garkin", + "type" => "User", + "url" => "/users/4.json" }, - { "path" => "exec_file", - "mode" => "100755", - "type" => "blob", - "size" => 75, - "sha" => "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", - "url" => "https://api.github.com/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057", - } - ] - } - TREE_EXTRA = { - "sha" => "fc6274d15fa3ae2ab983129fb037999f264ba9a7", - "url" => "https://api.github.com/repo/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7", - "tree" => [ { - "path" => "subdir/file.txt", - "mode" => "100644", - "type" => "blob", - "size" => 132, - "sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", - "url" => "https://api.github.com/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" - } ] - } - TREE_NEW = { - "sha" => "cd8274d15fa3ae2ab983129fb037999f264ba9a7", - "url" => "https://api.github.com/repo/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7", - "tree" => [ { - "path" => "file.rb", - "mode" => "100644", - "type" => "blob", - "size" => 132, - "sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", - "url" => "https://api.github.com/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" - } ] + "repositories" => [ + { + "id" => 1, + "name" => "main", + "url" => "/api/v1/repositories/1.json", + "platform" => { + "id" => 1, + "name" => "mdv_main", + "url" => "/api/v1/platforms/1.json" + } + }, + { + "id" => 3, + "name" => "main", + "url" => "/api/v1/repositories/3.json", + "platform" => { + "id" => 3, + "name" => "warpc_personal", + "url" => "/api/v1/platforms/3.json" + } + } + ], + }, + "url" => "/api/v1/projects/4661.json" } - GIT_COMMIT = { - "sha" => "7638417db6d59f3c431d3e1f261cc637155684cd", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", - "author" => { - "date" => "2010-04-10T14:10:01-07:00", - "name" => "Scott Chacon", - "email" => "schacon@gmail.com" - }, - "committer" => { - "date" => "2010-04-10T14:10:01-07:00", - "name" => "Scott Chacon", - "email" => "schacon@gmail.com" - }, - "message" => "added readme, because im a good github citizen\n", - "tree" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb", - "sha" => "691272480426f78a0138979dd3ce63b77f706feb" - }, - "parents" => [ + PROJECT_GET_ID_RESPONSE = { + "project" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5", - "sha" => "1acc419d4d6a9ce985db7be48c6349a0475975b5" + "id" => "resource id", + "name" => "name", + "visibility" => "visibility (open/hidden)", + "owner" => { + "id" => "owner id", + "name" => "owner name", + "url" => "url to owner profile" + }, + "url" => "url to project data page" } - ] } - NEW_COMMIT = { - "sha" => "7638417db6d59f3c431d3e1f261cc637155684cd", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", - "author" => { - "date" => "2008-07-09T16:13:30+12:00", - "name" => "Scott Chacon", - "email" => "schacon@gmail.com" - }, - "committer" => { - "date" => "2008-07-09T16:13:30+12:00", - "name" => "Scott Chacon", - "email" => "schacon@gmail.com" - }, - "message" => "my commit message", - "tree" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132", - "sha" => "827efc6d56897b048c772eb4087f854f46256132" - }, - "parents" => [ + PROJECT_GET_ID_RESPONSE_EXAMPLE = { + "project" => { - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0", - "sha" => "7d1b31e74ee336d15cbd21741bc88a537ed063a0" + "id" => 4661, + "name" => "hwinfo", + "visibility" => "open", + "owner" => { + "id" => 4, + "name" => "Yaroslav Garkin", + "type" => "User", + "url" => "/users/4.json" + }, + "url" => "/api/v1/projects/4661.json" + } + } + + REPOSITORY_DATA_RESPONSE = { + "repository" => + { + "id" => "resource id", + "name" => "name", + "created_at" => "created at date and time", + "updated_at" => "updated at date and time", + "description" => "description", + "platform" => { + "id" => "platform id", + "name" => "platform name", + "url" => "url to platform" + }, + "url" => "url to platform page" + }, + "url" => "url to platforms list page" + } + + REPOSITORY_DATA_RESPONSE_EXAMPLE = { + "repository" => + { + "id" => 30, + "name" => "main", + "platform" => { + "id" => 41, + "name" => "my_personal", + "url" => "/api/v1/platforms/41.json" + }, + }, + "url" => "/api/v1/repositories/30.json" + } + + PLATFORM_DATA_RESPONSE = { + "id" => "platform id", + "name" => "platform name", + "description" => "platform description", + "parent_platform_id" => "parent platform id", + "created_at" => "platform created at", + "updated_at" => "platform updated_at", + "released" => "platform released", + "visibility" => "platform visibility", + "platform_type" => "platform type", + "distrib_type" => "platform distribution type", + "owner" => { + "id" => "owner id", + "name" => "owner name", + "type" => "owner type", + "url" => "owner data path" + }, + "repositories" => [ + { + "id" => "repository for package storage id", + "name" => "repository for package storage name", + "url" => "path to repository data page" + } + ], + "url" => "platform path" + } + + PLATFORM_DATA_RESPONSE_EXAMPLE = { + "id" => 1, + "name" => "mdv_main", + "description" => "mdv_main", + "parent_platform_id" => nil, + "created_at" => "1326990586" , + "updated_at" => "1337171843", + "released" => "platform released", + "visibility" => "open", + "platform_type" => "main", + "distrib_type" => "mdv", + "owner" => { + "id" => 5, + "name" => "Timothy Bobrov", + "type" => "User", + "url" => "/users/5.json" + }, + "repositories" => [ + { + "id" => 1, + "name" => "main", + "url" => "/api/v1/repositories/1.json" + }, + { + "id" => 2, + "name" => "release", + "url" => "/api/v1/repositories/2.json" + } + ], + "url" => "/api/v1/platforms/1.json" + } + + PLATFORM_LIST_RESPONSE = { + "platforms" => [ + { + "id" => "platform id", + "name" => "platform name", + "platform_type" => "platform type", + "visibility" => "platform visibility (hidden/open)", + "owner" =>{ + "id" => "owner id", + "name" => "owner name", + "type" => "owner type", + "url" => "path to owner data" + }, + "url" => "path to platform data" } ] } - GITTAG = { - "tag" => "v0.0.1", - "sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac", - "message" => "initial version\n", - "tagger" => { - "name" => "Scott Chacon", - "email" => "schacon@gmail.com", - "date" => "2011-06-17T14:53:35-07:00" - }, - "object" => { - "type" => "commit", - "sha" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c" - } + PLATFORM_LIST_RESPONSE_EXAMPLE = { + "platforms" => [ + { + "id" => 26, + "name" => "fucktest", + "platform_type" => "mail", + "visibility" => "hidden", + "owner" => { + "id" => 5, + "name" => "Timothy Bobrov1", + "type" => "User", + "url" => "/users/5.json" + }, + "url" => "/api/v1/platforms/26.json" + }, + { + "id" => 17, + "name" => "aaa", + "platform_type" => "main", + "visibility" => "hidden", + "owner" => { + "id" => 5, + "name" => "Timothy Bobrov", + "type" => "User", + "url" => "/timothy_bobrov.json" + }, + "url" => "/api/v1/platforms/17.json" + }, + { + "id" => 18, + "name" => "timothy_tsvetkov", + "platform_type" => "main", + "visibility" => "hidden", + "owner" => { + "id" => 4, + "name" => "Yaroslav Garkin", + "type" => "User", + "url" => "/users/4.json" + }, + "url" => "/api/v1/platforms/18.json" + }, + ],"url" => "/api/v1/platforms.json" } - REF = { - "ref" => "refs/heads/sc/featureA", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA", - "object" => { - "type" => "commit", - "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" - } - } - - REFS = [ - { - "ref" => "refs/heads/master", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/master", - "object" => { - "type" => "commit", - "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" + ARCHITECTURE_LIST_RESPONSE = { + "architectures" => [ + { + "id" => "architecture identifier", + "name" => "architecture name" } - }, - { - "ref" => "refs/heads/gh-pages", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/gh-pages", - "object" => { - "type" => "commit", - "sha" => "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac" + ] + } + + ARCHITECTURE_LIST_RESPONSE_EXAMPLE = { + "architectures" => [ + { + "id" => 1, + "name" => "x86_64" + }, + { + "id" => 2, + "name" => "i586" } - }, - { - "ref" => "refs/tags/v0.0.1", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.0.1", - "object" => { - "type" => "tag", - "sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac", - "url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" - } - } - ] - - HOOK = { - "url" => "https://api.github.com/repos/octocat/Hello-World/hooks/1", - "updated_at" => "2011-09-06T20:39:23Z", - "created_at" => "2011-09-06T17:26:27Z", - "name" => "web", - "events" => ["push"], - "active" => true, - "config" => - {'url' => 'http://example.com', 'content_type' => 'json'}, - "id" => 1 + ] } - OAUTH_ACCESS = { - "id" => 1, - "url" => "https://api.github.com/authorizations/1", - "scopes" => ["public_repo"], - "token" => "abc123", - "app" => { - "url" => "http://my-github-app.com", - "name" => "my github app" - }, - "note" => "optional note", - "note_url" => "http://optional/note/url", - "updated_at" => "2011-09-06T20:39:23Z", - "created_at" => "2011-09-06T17:26:27Z" - } - - EVENT = { - :type => "Event", - :public => true, - :payload => {}, - :repo => { - :id => 3, - :name => "octocat/Hello-World", - :url => "https://api.github.com/repos/octocat/Hello-World" - }, - :actor => USER, - :org => USER, - :created_at => "2011-09-06T17:26:27Z", - :id => "12345" - } - - README_CONTENT = { - "type" => "file", - "encoding" => "base64", - "_links" => { - "git" => "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", - "self" => "https://api.github.com/repos/pengwynn/octokit/contents/README.md", - "html" => "https://github.com/pengwynn/octokit/blob/master/README.md" - }, - "size" => 5362, - "name" => "README.md", - "path" => "README.md", - "content" => "encoded content ...", - "sha" => "3d21ec53a331a6f037a91c368710b99387d012c1" - } - - STATUS = { - "created_at" => "2012-07-20T01:19:13Z", - "updated_at" => "2012-07-20T01:19:13Z", - "state" => "success", - "target_url" => "https://ci.example.com/1000/output", - "description" => "Build has completed successfully", - "id" => 1, - "url" => "https://api.github.com/repos/octocat/example/statuses/1", - "creator" => USER - } - - BLOB = { - :content => "Content of the blob", - :encoding => "utf-8", - :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", - :size => 100 - } end end