Skip to main content
3 de 3
Mejoras en el formato.
Shaz
  • 29.2k
  • 18
  • 40
  • 61

Parsear 2 jsonArray en Ruby

Tengo este pequeño problema en Ruby, tengo una api con este response:

response: [
  {
    waspurchase: 1,
    purchase_data: {
      gateway: "plazavipgate",
      gateway_text: "TEXT_PGS_PAYMENT_ASD_ASD_ASD",
      gateway_data: {
        card_owner_name: "PEPITO",
        card_type: "2",
        card_number_display: "XXXX XXXX XXXX 1234",
        address: "ASDSDADSD",
        city: "ASDASDSADSA",
        state: "ASDASDSAD",
        expiration_month: "1",
        expiration_year: "123",
        birth_date: "",
        phone_number: "5555555555",
        zip_code: "1234"
      },
      beggining: "17/07/2017 10:29:51",
      expiration: "17/08/2017 10:29:51",
      expiration_promo: "17/08/2017 10:29:51",
      in_process_canceled: 0,
      purchase_id: "12321414"
    },
    offer_id: "123457",
    user_id: 12345623,
    price: "17/07/2017 10:29:51",
    currency: "$",
    offer_text: "TEXT_PGS_OFFER_ASD_ASD_SVOD_30D"
  },
  {
    waspurchase: 0,
    purchase_data: "",
    offer_id: "1234567",
    user_id: 1234567,
    price: "123",
    currency: "$",
    offer_text: "TEXT_PGS_OFFER_ASD_ABONO_ASD"
  }
]

Y necesito parsear de la primera lista de datos el campo card_owner_name, el problema es que al parsear se pierde ya que dentro del response hay campos repetidos.