Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Fix JSON pretty print in Ruby sample #1254

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/resources/com/google/api/codegen/ruby/sample.snip
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@
@if class.pageStreaming.isResourceMap
{@class.pageStreaming.pageVarName}.each do |{@class.pageStreaming.resourceKeyVarName}, {@class.pageStreaming.resourceValueVarName}|
@# TODO: Change code below to process each ({@class.pageStreaming.resourceKeyVarName}, {@class.pageStreaming.resourceValueVarName}) pair:
puts String({@class.pageStreaming.resourceKeyVarName} << " => " << JSON.pretty_generate({@class.pageStreaming.resourceValueVarName})
puts String({@class.pageStreaming.resourceKeyVarName} << " => " << JSON.pretty_unparse({@class.pageStreaming.resourceValueVarName}.to_h)
end
@else
# We don't handle non-repeated page streaming resources separately in Ruby
# because the fetch_all treats them correctly.
{@class.pageStreaming.pageVarName}.each do |{@class.pageStreaming.resourceVarName}|
@# TODO: Change code below to process each `{@class.pageStreaming.resourceVarName}` resource:
puts JSON.pretty_generate({@class.pageStreaming.resourceVarName})
puts JSON.pretty_unparse({@class.pageStreaming.resourceVarName}.to_h)
end
@end
@else
@if class.hasResponse
{@class.responseVarName} = {@methodCall(class)}({@paramList(class.methodCallFieldVarNames)})

@# TODO: Change code below to process the `{@class.responseVarName}` object:
puts JSON.pretty_generate({@class.responseVarName})
puts JSON.pretty_unparse({@class.responseVarName}.to_h)
@else
{@methodCall(class)}({@paramList(class.methodCallFieldVarNames)})
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ id = 0 # TODO: Update placeholder value.
response = service.get_account(id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -47,7 +47,7 @@ service.authorization = nil
response = service.list_accounts()

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -77,7 +77,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Account.new
response = service.patch_account(id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -107,7 +107,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Account.new
response = service.update_account(id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -133,7 +133,7 @@ account_id = 0 # TODO: Update placeholder value.
response = service.get_billing_info(account_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -156,7 +156,7 @@ service.authorization = nil
response = service.list_billing_infos()

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -185,7 +185,7 @@ billing_id = 0 # TODO: Update placeholder value.
response = service.get_budget(account_id, billing_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -218,7 +218,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Budget.new
response = service.patch_budget(account_id, billing_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -251,7 +251,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Budget.new
response = service.update_budget(account_id, billing_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -308,7 +308,7 @@ buyer_creative_id = 'my-buyer-creative-id' # TODO: Update placeholder value.
response = service.get_creative(account_id, buyer_creative_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -334,7 +334,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Creative.new
response = service.insert_creative(request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -360,7 +360,7 @@ end

items.each do |creative|
# TODO: Change code below to process each `creative` resource:
puts JSON.pretty_generate(creative)
puts JSON.pretty_unparse(creative.to_h)
end
# BEFORE RUNNING:
# ---------------
Expand Down Expand Up @@ -390,7 +390,7 @@ buyer_creative_id = 'my-buyer-creative-id' # TODO: Update placeholder value.
response = service.list_creative_deals(account_id, buyer_creative_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -447,7 +447,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::DeleteOrderDealsRequest.new
response = service.delete_marketplacedeal_order_deals(proposal_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -476,7 +476,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::AddOrderDealsRequest.new
response = service.insert_marketplacedeal(proposal_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -503,7 +503,7 @@ proposal_id = 'my-proposal-id' # TODO: Update placeholder value.
response = service.list_marketplacedeals(proposal_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -532,7 +532,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::EditAllOrderDealsRequest.new
response = service.update_marketplacedeal(proposal_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -561,7 +561,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::AddOrderNotesRequest.new
response = service.insert_marketplacenote(proposal_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -588,7 +588,7 @@ proposal_id = 'my-proposal-id' # TODO: Update placeholder value.
response = service.list_marketplacenotes(proposal_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -645,7 +645,7 @@ start_date_time = '' # TODO: Update placeholder value.
response = service.list_performance_reports(account_id, end_date_time, start_date_time)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -699,7 +699,7 @@ config_id = 0 # TODO: Update placeholder value.
response = service.get_pretargeting_config(account_id, config_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -728,7 +728,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::PretargetingConfig.new
response = service.insert_pretargeting_config(account_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -754,7 +754,7 @@ account_id = 0 # TODO: Update placeholder value.
response = service.list_pretargeting_configs(account_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -787,7 +787,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::PretargetingConfig.new
response = service.patch_pretargeting_config(account_id, config_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -820,7 +820,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::PretargetingConfig.new
response = service.update_pretargeting_config(account_id, config_id, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -846,7 +846,7 @@ product_id = 'my-product-id' # TODO: Update placeholder value.
response = service.get_product(product_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -869,7 +869,7 @@ service.authorization = nil
response = service.search_products()

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -895,7 +895,7 @@ proposal_id = 'my-proposal-id' # TODO: Update placeholder value.
response = service.get_proposal(proposal_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -921,7 +921,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::CreateOrdersRequest.new
response = service.insert_proposal(request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -960,7 +960,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Proposal.new
response = service.patch_proposal(proposal_id, revision_number, update_action, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -983,7 +983,7 @@ service.authorization = nil
response = service.search_proposals()

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand Down Expand Up @@ -1044,7 +1044,7 @@ request_body = Google::Apis::AdexchangebuyerV1_4::Proposal.new
response = service.update_proposal(proposal_id, revision_number, update_action, request_body)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
# BEFORE RUNNING:
# ---------------
# 1. If not already done, enable the Ad Exchange Buyer API
Expand All @@ -1070,4 +1070,4 @@ account_id = 0 # TODO: Update placeholder value.
response = service.list_pub_profiles(account_id)

# TODO: Change code below to process the `response` object:
puts JSON.pretty_generate(response)
puts JSON.pretty_unparse(response.to_h)
Loading