Sha256: 44f6372b2a3fc06ecb2839f9e48e54897bff3234a9edb76bd70c8abfe58a535c

Contents?: true

Size: 641 Bytes

Versions: 14

Compression:

Stored size: 641 Bytes

Contents

require 'haveapi/go_client/parameters/base'

module HaveAPI::GoClient
  class Parameters::Typed < Parameters::Base
    handle do |_role, _direction, _name, desc|
      !%w[Custom Resource].include?(desc[:type])
    end

    protected

    def do_resolve
      @go_in_type = get_go_type(desc[:type])
      @go_out_type = get_go_type(desc[:type])
    end

    def get_go_type(v)
      case v
      when 'String', 'Text', 'Datetime'
        'string'
      when 'Integer'
        'int64'
      when 'Float'
        'float64'
      when 'Boolean'
        'bool'
      else
        raise "unsupported data type '#{v}'"
      end
    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/parameters/typed.rb
haveapi-go-client-0.24.0 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.7 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.6 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.5 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.4 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.3 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.2 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.1 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.23.0 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.22.1 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.22.0 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.21.1 lib/haveapi/go_client/parameters/typed.rb
haveapi-go-client-0.21.0 lib/haveapi/go_client/parameters/typed.rb