Class: AdsCommon::Build::SavonServiceGenerator

Inherits:
SavonAbstractGenerator show all
Defined in:
lib/ads_common/build/savon_service_generator.rb

Constant Summary collapse

SERVICE_TEMPLATE =
%q{<% %>
# Encoding: utf-8
#
# This is auto-generated code, changes will be overwritten.
#
# Copyright:: Copyright <%= @year %>, Google Inc. All Rights Reserved.
# License:: Licensed under the Apache License, Version 2.0.
#
# <%= @generator_stamp %>

require 'ads_common/savon_service'
require '<%= @require_path %>/<%= @service_name.to_s.snakecase %>_registry'

<%= @modules_open_string %>

  class <%= @service_name %> < AdsCommon::SavonService
    def initialize(config, endpoint)
      namespace = '<%= @namespace %>'
      super(config, endpoint, namespace, :<%= @version %>)
    end
    <% @actions.each do |action| %>

    def <%= action %>(*args, &block)
      return execute_action('<%= action %>', args, &block)
    end

    def <%= action %>_to_xml(*args)
      return get_soap_xml('<%= action %>', args)
    end
    <% end %>

    private

    def get_service_registry()
      return <%= @service_name %>Registry
    end

    def get_module()
      return <%= [@api_name, @version.to_s.upcase, @service_name].join('::') %>
    end
  end
<%= @modules_close_string %>

}.gsub(/^      /, '')

Instance Method Summary collapse

Methods inherited from SavonAbstractGenerator

#generate_code

Constructor Details

#initialize(args) ⇒ SavonServiceGenerator

Returns a new instance of SavonServiceGenerator.



72
73
74
75
# File 'lib/ads_common/build/savon_service_generator.rb', line 72

def initialize(args)
  super(args)
  @actions = []
end

Instance Method Details

#add_actions(actions) ⇒ Object



77
78
79
# File 'lib/ads_common/build/savon_service_generator.rb', line 77

def add_actions(actions)
  @actions += actions
end

#get_code_templateObject



81
82
83
# File 'lib/ads_common/build/savon_service_generator.rb', line 81

def get_code_template()
  SERVICE_TEMPLATE
end