require "google/ads/google_ads/version_alternate" require "google/ads/google_ads/factories/v13/resources" require "google/ads/google_ads/factories/v13/services" require "google/ads/google_ads/factories/v13/enums" require "google/ads/google_ads/factories/v13/operations" require "google/ads/google_ads/factories/v14/resources" require "google/ads/google_ads/factories/v14/services" require "google/ads/google_ads/factories/v14/enums" require "google/ads/google_ads/factories/v14/operations" require "google/ads/google_ads/factories/v15/resources" require "google/ads/google_ads/factories/v15/services" require "google/ads/google_ads/factories/v15/enums" require "google/ads/google_ads/factories/v15/operations" module Google module Ads module GoogleAds module Factories Factory = Struct.new(:resources, :services, :enums, :operations) FACTORY_V13 = Factory.new( V13::Resources, V13::Services, V13::Enums, V13::Operations ).freeze FACTORY_V14 = Factory.new( V14::Resources, V14::Services, V14::Enums, V14::Operations ).freeze FACTORY_V15 = Factory.new( V15::Resources, V15::Services, V15::Enums, V15::Operations ).freeze VERSIONS = [ :V13, :V14, :V15 ] HIGHEST_VERSION = :V15 def self.version_alternate_for(type) unless [:resources, :services, :enums, :operations].include?(type) raise ArgumentError.new( "Dont have version alternate for #{type}, valid values are :resources, :services, :enums, :operations, got #{type}" ) end VersionAlternate.new( FACTORY_V15.public_send(type), { V13: FACTORY_V13.public_send(type), V14: FACTORY_V14.public_send(type), V15: FACTORY_V15.public_send(type) } ) end def self.versions end def self.at_version(version) case version when :V13 FACTORY_V13 when :V14 FACTORY_V14 when :V15 FACTORY_V15 else raise ArgumentError.new("Got unkown version: #{version}") end end end end end end