Skip to content

Commit

Permalink
Add native_properties support to tourinsoft v3
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Apr 15, 2024
1 parent 2574b11 commit 111ebc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 10 additions & 0 deletions datasources/sources/tourinsoft_v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class Settings < Source::SourceSettings
extend T::Generic
SettingsType = type_member{ { upper: Settings } } # Generic param

def jp(object, path)
JsonPath.on(object, "$.#{path}")
end

def self.fetch(client, syndication)
url = "https://api-v3.tourinsoft.com/api/syndications/#{client}/#{syndication}?format=json"
resp = HTTP.follow.get(url)
Expand Down Expand Up @@ -58,4 +62,10 @@ def map_id(feat)
def map_updated_at(feat)
feat['Updated']
end

def map_native_properties(feat, properties)
properties.transform_values{ |path|
jp(feat, path)
}.compact_blank
end
end
4 changes: 0 additions & 4 deletions datasources/sources/tourinsoft_v3_sirtaqui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ class Settings < TourinsoftV3Source::Settings
extend T::Generic
SettingsType = type_member{ { upper: Settings } } # Generic param

def jp(object, path)
JsonPath.on(object, "$.#{path}")
end

def route(routes, distance)
routes&.select{ |r| !r['Modedelocomotion'].nil? }&.collect{ |r|
practice = r['Modedelocomotion']['ThesLibelle']
Expand Down

0 comments on commit 111ebc2

Please sign in to comment.