Merge branch 'cd-v3-parity'
This commit is contained in:
commit
6b0850813c
|
@ -34,6 +34,7 @@ module Travis::API::V3
|
|||
def fields
|
||||
fields = { :"@type" => type }
|
||||
fields[:@href] = href if href
|
||||
fields[:@representation] = representation
|
||||
fields[:@pagination] = pagination_info if meta_data.include? :pagination
|
||||
fields
|
||||
end
|
||||
|
@ -48,13 +49,17 @@ module Travis::API::V3
|
|||
result = fields
|
||||
included = self.included.dup
|
||||
result[collection_key] = list.map do |entry|
|
||||
rendered = render_entry(entry, included: included, mode: :standard, **options)
|
||||
rendered = render_entry(entry, included: included, mode: representation, **options)
|
||||
included << entry
|
||||
rendered
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def representation
|
||||
:standard
|
||||
end
|
||||
|
||||
def render_entry(entry, **options)
|
||||
Renderer.render_value(entry, **options)
|
||||
end
|
||||
|
|
|
@ -20,6 +20,7 @@ describe Travis::API::V3::Services::Accounts::ForCurrentUser do
|
|||
example { expect(JSON.load(body)).to be == {
|
||||
"@type" => "accounts",
|
||||
"@href" => "/v3/accounts",
|
||||
"@representation" => "standard",
|
||||
"accounts" => [{
|
||||
"@type" => "account",
|
||||
"@representation" =>"standard",
|
||||
|
|
|
@ -27,6 +27,7 @@ describe Travis::API::V3::Services::Builds::Find do
|
|||
example { expect(parsed_body).to be == {
|
||||
"@type" => "builds",
|
||||
"@href" => "/v3/repo/#{repo.id}/builds?limit=1",
|
||||
"@representation" => "standard",
|
||||
"@pagination" => {
|
||||
"limit" => 1,
|
||||
"offset" => 0,
|
||||
|
@ -94,6 +95,7 @@ describe Travis::API::V3::Services::Builds::Find do
|
|||
example { expect(parsed_body).to be == {
|
||||
"@type" => "builds",
|
||||
"@href" => "/v3/repo/#{repo.id}/builds?limit=1",
|
||||
"@representation" => "standard",
|
||||
"@pagination" => {
|
||||
"limit" => 1,
|
||||
"offset" => 0,
|
||||
|
|
|
@ -20,6 +20,7 @@ describe Travis::API::V3::Services::Organizations::ForCurrentUser do
|
|||
example { expect(JSON.load(body)).to be == {
|
||||
"@type" => "organizations",
|
||||
"@href" => "/v3/orgs",
|
||||
"@representation" => "standard",
|
||||
"organizations" => [{
|
||||
"@type" => "organization",
|
||||
"@href" => "/v3/org/#{org.id}",
|
||||
|
|
|
@ -15,6 +15,7 @@ describe Travis::API::V3::Services::Owner::Repositories do
|
|||
example { expect(JSON.load(body)).to be == {
|
||||
"@type" => "repositories",
|
||||
"@href" => "/v3/owner/svenfuchs/repos",
|
||||
"@representation" => "standard",
|
||||
"repositories" => [{
|
||||
"@type" => "repository",
|
||||
"@href" => "/v3/repo/#{repo.id}",
|
||||
|
|
|
@ -15,6 +15,7 @@ describe Travis::API::V3::Services::Repositories::ForCurrentUser do
|
|||
example { expect(JSON.load(body)).to be == {
|
||||
"@type" => "repositories",
|
||||
"@href" => "/v3/repos",
|
||||
"@representation" => "standard",
|
||||
"repositories" => [{
|
||||
"@type" => "repository",
|
||||
"@href" => "/v3/repo/#{repo.id}",
|
||||
|
|
Loading…
Reference in New Issue
Block a user