Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error: no implicit conversion of Symbol into Integer #24

Closed
arturictus opened this issue Aug 3, 2016 · 1 comment
Closed

Improve error: no implicit conversion of Symbol into Integer #24

arturictus opened this issue Aug 3, 2016 · 1 comment
Assignees

Comments

@arturictus
Copy link
Owner

arturictus commented Aug 3, 2016

The mapper is wrong because it uses from_child and the original has no children, but the error should be better.

mapper

module Worldmate
  class BaobabHotelToModelMapper < HashMap::Base
    after_each HashMap::BlankToNil
    transforms_output proc { |out| out.compact }

    property :name, from: :hotel_name
    properties :phone, :fax
    from_child :address do
      property :address, from: :street
      property :telephone, from: :phone
      property :zip, from: :postal_code
      properties :city, :country_code
    end
  end
end

execution:

original = {
        "id"=>"32ec4be6-2cc2-4acf-ac03-f2d6c1111ee9",
        "name"=>"Hotel Arts Barcelona",
        "address"=>"Carrer de la Marina 19-21",
        "time_zone"=>"Europe/Madrid",
        "state"=>"Barcelona",
        "city"=>"Barcelona",
        "state_code"=>"Barcelona",
        "postal_code"=>"08005",
        "country_code"=>"ES",
        "phone_number"=>"34932211000",
        "latitude"=>41.3870201,
        "longitude"=>2.1960815,
        "website"=>"http://www.ritzcarlton.com/en/hotels/spain/barcelona",
        "chain_code"=>"RZ",
        "sabre_id"=>"27456",
        "google_id"=>"ChIJG11mEw-jpBIRVUCfp2u8Pv8",
        "amadeus_id"=>"RZBCNBAR",
        "fcm_id"=>"139802"
      }
@arturictus
Copy link
Owner Author

same as #30, I close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant