diff --git a/lib/whatsapp_sdk/resource/location.rb b/lib/whatsapp_sdk/resource/location.rb index 381be8b..a163bf0 100644 --- a/lib/whatsapp_sdk/resource/location.rb +++ b/lib/whatsapp_sdk/resource/location.rb @@ -1,3 +1,6 @@ +# typed: false +# frozen_string_literal: true + module WhatsappSdk module Resource class Location @@ -46,4 +49,4 @@ def to_json end end end -end \ No newline at end of file +end diff --git a/lib/whatsapp_sdk/resource/parameter_object.rb b/lib/whatsapp_sdk/resource/parameter_object.rb index f75f17a..439892e 100644 --- a/lib/whatsapp_sdk/resource/parameter_object.rb +++ b/lib/whatsapp_sdk/resource/parameter_object.rb @@ -93,7 +93,16 @@ class Type < T::Enum location: T.nilable(Location) ).void end - def initialize(type:, text: nil, currency: nil, date_time: nil, image: nil, document: nil, video: nil, location: nil) + def initialize( + type:, + text: nil, + currency: nil, + date_time: nil, + image: nil, + document: nil, + video: nil, + location: nil + ) @type = T.let(deserialize_type(type), Type) @text = text @currency = currency diff --git a/test/whatsapp/api/messages_test.rb b/test/whatsapp/api/messages_test.rb index e828807..bfd31c4 100644 --- a/test/whatsapp/api/messages_test.rb +++ b/test/whatsapp/api/messages_test.rb @@ -579,7 +579,8 @@ def test_send_template_with_success_response_by_passing_components currency = Resource::Currency.new(code: "USD", amount: 1000, fallback_value: "1000") date_time = Resource::DateTime.new(fallback_value: "2020-01-01T00:00:00Z") image = Resource::Media.new(type: Resource::Media::Type::Image, link: "http(s)://URL") - location = Resource::Location.new(latitude: 25.779510, longitude: -80.338631, name: "miami store", address: "820 nw 87th ave, miami, fl") + location = Resource::Location.new(latitude: 25.779510, longitude: -80.338631, name: "miami store", + address: "820 nw 87th ave, miami, fl") parameter_image = Resource::ParameterObject.new( type: Resource::ParameterObject::Type::Image, image: image diff --git a/test/whatsapp/resource/location_test.rb b/test/whatsapp/resource/location_test.rb index 02640ba..cb2208e 100644 --- a/test/whatsapp/resource/location_test.rb +++ b/test/whatsapp/resource/location_test.rb @@ -1,5 +1,6 @@ # typed: true # frozen_string_literal: true + require "test_helper" require "resource/location" @@ -8,8 +9,12 @@ module Resource module Resource class LocationTest < Minitest::Test def test_to_json - location = Location.new(latitude: 25.779510, longitude: -80.338631, name: "Miami Store", address: "820 NW 87th Ave, Miami, FL") - assert_equal({ latitude: 25.779510, longitude: -80.338631, name: "Miami Store", address: "820 NW 87th Ave, Miami, FL" }, location.to_json) + location = Location.new(latitude: 25.779510, longitude: -80.338631, name: "Miami Store", + address: "820 NW 87th Ave, Miami, FL") + assert_equal( + { latitude: 25.779510, longitude: -80.338631, name: "Miami Store", + address: "820 NW 87th Ave, Miami, FL" }, location.to_json + ) end end end diff --git a/test/whatsapp/resource/parameter_object_test.rb b/test/whatsapp/resource/parameter_object_test.rb index 70558be..d949122 100644 --- a/test/whatsapp/resource/parameter_object_test.rb +++ b/test/whatsapp/resource/parameter_object_test.rb @@ -22,7 +22,8 @@ def setup @video_media = Media.new(type: Media::Type::Video, id: "123") @currency = Currency.new(code: "USD", amount: 1000, fallback_value: "USD") @date_time = DateTime.new(fallback_value: "2020-01-01T00:00:00Z") - @location = Location.new(latitude: 25.779510, longitude: -80.338631, name: "Miami Store", address: "820 NW 87th Ave, Miami, FL") + @location = Location.new(latitude: 25.779510, longitude: -80.338631, name: "Miami Store", + address: "820 NW 87th Ave, Miami, FL") end [