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 2015, 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
    <% 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.



70
71
72
73
# File 'lib/ads_common/build/savon_service_generator.rb', line 70

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

Instance Method Details

#add_actions(actions) ⇒ Object



75
76
77
# File 'lib/ads_common/build/savon_service_generator.rb', line 75

def add_actions(actions)
  @actions += actions
end

#get_code_templateObject



79
80
81
# File 'lib/ads_common/build/savon_service_generator.rb', line 79

def get_code_template()
  SERVICE_TEMPLATE
end