Sha256: 8ceaf2c6dcf854df5c2738d0565a96495fa896de83f414be2fdba4b3131353fa

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

require 'haveapi/go_client/utils'

module HaveAPI::GoClient
  class InputOutput
    include Utils

    # @return [Action]
    attr_reader :action

    # @return [Symbol]
    attr_reader :role

    # @return [Symbol]
    attr_reader :direction

    # @return [String]
    attr_reader :layout

    # @return [String]
    attr_reader :namespace

    # @return [Array<Parameter>]
    attr_reader :parameters

    # @return [String]
    attr_reader :go_type

    # @return [String]
    attr_reader :go_namespace

    def initialize(action, role, direction, desc, prefix: nil)
      @action = action
      @role = role
      @direction = direction
      @layout = desc[:layout]
      @namespace = desc[:namespace]
      @parameters = desc[:parameters].map do |k, v|
        Parameter.new(role, direction, self, k.to_s, v)
      end.compact.sort!
      @go_type = action.go_type + (prefix ? prefix : '') + direction.to_s.capitalize
      @go_namespace = camelize(desc[:namespace])
    end

    def resolve_associations
      parameters.each { |p| p.resolve }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
haveapi-go-client-0.20.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.19.3 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.19.2 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.19.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.19.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.18.2 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.18.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.18.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.17.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.16.3 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.16.2 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.16.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.16.0 lib/haveapi/go_client/input_output.rb