# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

require 'date'
require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
marketplace_private_offer_client =
  OCI::MarketplacePrivateOffer::OfferClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
update_offer_response =
  marketplace_private_offer_client.update_offer(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-offerId-Value',
    OCI::MarketplacePrivateOffer::Models::UpdateOfferDetails.new(
      display_name: 'EXAMPLE-displayName-Value',
      buyer_compartment_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-buyerCompartmentId-Value',
      description: 'EXAMPLE-description-Value',
      internal_notes: 'EXAMPLE-internalNotes-Value',
      time_start_date: DateTime.parse('2004-07-23T06:38:12.134Z'),
      duration: 'EXAMPLE-duration-Value',
      time_accept_by: DateTime.parse('2001-05-13T22:04:46.411Z'),
      pricing:
        OCI::MarketplacePrivateOffer::Models::Pricing.new(
          currency_type: 'qqq', total_amount: 152, billing_cycle: 'ONE_TIME'
        ),
      buyer_information:
        OCI::MarketplacePrivateOffer::Models::BuyerInformation.new(
          company_name: 'EXAMPLE-companyName-Value',
          note_to_buyer: 'EXAMPLE-noteToBuyer-Value',
          primary_contact:
            OCI::MarketplacePrivateOffer::Models::Contact.new(
              first_name: 'EXAMPLE-firstName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              email: 'EXAMPLE-email-Value'
            ),
          additional_contacts: [
            OCI::MarketplacePrivateOffer::Models::Contact.new(
              first_name: 'EXAMPLE-firstName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              email: 'EXAMPLE-email-Value'
            )
          ]
        ),
      seller_information:
        OCI::MarketplacePrivateOffer::Models::SellerInformation.new(
          primary_contact:
            OCI::MarketplacePrivateOffer::Models::Contact.new(
              first_name: 'EXAMPLE-firstName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              email: 'EXAMPLE-email-Value'
            ),
          additional_contacts: [
            OCI::MarketplacePrivateOffer::Models::Contact.new(
              first_name: 'EXAMPLE-firstName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              email: 'EXAMPLE-email-Value'
            )
          ]
        ),
      resource_bundles: [
        OCI::MarketplacePrivateOffer::Models::ResourceBundle.new(
          type: 'LISTING',
          quantity: 113,
          unit_of_measurement: 'INSTANCE_PER_HOUR',
          resource_ids: %w[EXAMPLE--Value]
        )
      ],
      custom_fields: [
        OCI::MarketplacePrivateOffer::Models::CustomField.new(
          key: 'EXAMPLE-key-Value', value: 'EXAMPLE-value-Value'
        )
      ],
      freeform_tags: {
        'EXAMPLE_KEY_VTHPF' => 'EXAMPLE_VALUE_o2t64YpWOtgCse6fVnAJ'
      },
      defined_tags: {
        'EXAMPLE_KEY_rPhgU' => { 'EXAMPLE_KEY_GxaDN' => 'EXAMPLE--Value' }
      }
    )
  )

# Get the data from response
puts "#{update_offer_response.data}"