Skip to content

Commit

Permalink
fix styling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacio-chiazzo committed Aug 31, 2024
1 parent 1e959e6 commit c7fc40c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/whatsapp_sdk/resource/location.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# typed: false
# frozen_string_literal: true

module WhatsappSdk
module Resource
class Location
Expand Down Expand Up @@ -46,4 +49,4 @@ def to_json
end
end
end
end
end
11 changes: 10 additions & 1 deletion lib/whatsapp_sdk/resource/parameter_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/whatsapp/api/messages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions test/whatsapp/resource/location_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# typed: true
# frozen_string_literal: true

require "test_helper"
require "resource/location"

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/whatsapp/resource/parameter_object_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

[
Expand Down

0 comments on commit c7fc40c

Please sign in to comment.