Sha256: 07713447d3e46b50aa71100d248704dda2af6c2dc71522e6cfd8a9c458f9cc90

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 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 || '') + direction.to_s.capitalize
      @go_namespace = camelize(desc[:namespace])
    end

    def resolve_associations
      parameters.each(&:resolve)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
haveapi-go-client-0.25.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.24.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.7 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.6 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.5 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.4 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.3 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.2 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.23.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.22.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.22.0 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.21.1 lib/haveapi/go_client/input_output.rb
haveapi-go-client-0.21.0 lib/haveapi/go_client/input_output.rb