Class: AppStoreDevApi::Client::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/app_store_dev_api/client/builder.rb

Instance Method Summary collapse

Instance Method Details

#sourceObject



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/app_store_dev_api/client/builder.rb', line 77

def source
  @source ||= begin
    require 'erb'

    erb = ERB.new(TEMPLATE, trim_mode: '%-')

    erb.result(binding)
  end

  @source
end

#web_service_endpointsObject



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/app_store_dev_api/client/builder.rb', line 57

def web_service_endpoints
  @web_service_endpoints ||= begin
    schema_content = File.read(schema_path)
    schema = JSON.parse(schema_content)
    
    schema['web_service_endpoints'].map do |endpoint|
      endpoint.symbolize_keys.tap do |ep|
        ep[:see] ||= 'https://developer.apple.com/documentation/appstoreconnectapi'
      end
    end
  end
end

#write(output_file = 'lib/app_store_dev_api/client_generated.rb') ⇒ Object



70
71
72
73
74
75
# File 'lib/app_store_dev_api/client/builder.rb', line 70

def write(output_file = 'lib/app_store_dev_api/client_generated.rb')
  File.write(output_file, source)
  puts "✅ 已生成方法定义到: #{output_file}"
  puts "⚠️  注意: 这是可选的生成文件,仅用于 IDE 支持"
  puts "   默认使用动态调度,无需此文件"
end