Class: CnsOpenapiRubyClient::CorporationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cns_openapi_ruby_client/api/corporations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CorporationsApi



19
20
21
# File 'lib/cns_openapi_ruby_client/api/corporations_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cns_openapi_ruby_client/api/corporations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_corporations(name, type, opts = {}) ⇒ ResponseWrapper

法人名を指定しリクエストすることで、指定した法人名の基本3情報及び付随する情報を取得することができます。法人名による法人情報の取得

Options Hash (opts):

  • :mode (Integer)

    検索方式を指定できます。 指定しない場合は、「1」(前方一致検索)で処理します。 (default to 1)

  • :target (Integer)

    検索対象を指定できます。 指定しない場合は、「1」(JIS 第一・第二水準)で処理します。 (default to 1)

  • :address (String)

    国内所在地の都道府県コード又は 都道府県コードと市区町村コードを組み合わせたコードのいずれかを指定できます。 市区町村コードのみではエラー(エラーコード 051)となります。

  • :kind (String)

    法人種別を指定できます。

  • :change (Integer)

    法人名や所在地の変更があった法人等に ついて過去の情報を含めて検索するかどうかを指定できます。 (default to 0)

  • :close (Integer)

    登記記録の閉鎖等があった法人等の情報を取得するかどうかを指定できます。 (default to 1)

  • :from (String)

    取得の対象とする法人番号指定年月日の開始日を指定できます。

  • :to (String)

    取得の対象とする法人番号指定年月日の終了日を指定できます。

  • :divide (Integer)

    分割番号を指定できます。 指定しない場合は、「1」で処理します。



37
38
39
40
# File 'lib/cns_openapi_ruby_client/api/corporations_api.rb', line 37

def get_corporations(name, type, opts = {})
  data, _status_code, _headers = get_corporations_with_http_info(name, type, opts)
  data
end

#get_corporations_with_http_info(name, type, opts = {}) ⇒ Array<(ResponseWrapper, Integer, Hash)>

法人名を指定しリクエストすることで、指定した法人名の基本3情報及び付随する情報を取得することができます。法人名による法人情報の取得

Options Hash (opts):

  • :mode (Integer)

    検索方式を指定できます。 指定しない場合は、「1」(前方一致検索)で処理します。

  • :target (Integer)

    検索対象を指定できます。 指定しない場合は、「1」(JIS 第一・第二水準)で処理します。

  • :address (String)

    国内所在地の都道府県コード又は 都道府県コードと市区町村コードを組み合わせたコードのいずれかを指定できます。 市区町村コードのみではエラー(エラーコード 051)となります。

  • :kind (String)

    法人種別を指定できます。

  • :change (Integer)

    法人名や所在地の変更があった法人等に ついて過去の情報を含めて検索するかどうかを指定できます。

  • :close (Integer)

    登記記録の閉鎖等があった法人等の情報を取得するかどうかを指定できます。

  • :from (String)

    取得の対象とする法人番号指定年月日の開始日を指定できます。

  • :to (String)

    取得の対象とする法人番号指定年月日の終了日を指定できます。

  • :divide (Integer)

    分割番号を指定できます。 指定しない場合は、「1」で処理します。



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/cns_openapi_ruby_client/api/corporations_api.rb', line 57

def get_corporations_with_http_info(name, type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CorporationsApi.get_corporations ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling CorporationsApi.get_corporations"
  end
  if @api_client.config.client_side_validation && name.to_s.length < 1
    fail ArgumentError, 'invalid value for "name" when calling CorporationsApi.get_corporations, the character length must be great than or equal to 1.'
  end

  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling CorporationsApi.get_corporations"
  end
  # verify enum value
  allowable_values = ["12", "01", "02"]
  if @api_client.config.client_side_validation && !allowable_values.include?(type)
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 2]
  if @api_client.config.client_side_validation && opts[:'mode'] && !allowable_values.include?(opts[:'mode'])
    fail ArgumentError, "invalid value for \"mode\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 2, 3]
  if @api_client.config.client_side_validation && opts[:'target'] && !allowable_values.include?(opts[:'target'])
    fail ArgumentError, "invalid value for \"target\", must be one of #{allowable_values}"
  end
  pattern = Regexp.new(/[0-9]{2,5}/)
  if @api_client.config.client_side_validation && !opts[:'address'].nil? && opts[:'address'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"address\"]' when calling CorporationsApi.get_corporations, must conform to the pattern #{pattern}."
  end

  allowable_values = ["01", "02", "03", "04"]
  if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
    fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1]
  if @api_client.config.client_side_validation && opts[:'change'] && !allowable_values.include?(opts[:'change'])
    fail ArgumentError, "invalid value for \"change\", must be one of #{allowable_values}"
  end
  allowable_values = [0, 1]
  if @api_client.config.client_side_validation && opts[:'close'] && !allowable_values.include?(opts[:'close'])
    fail ArgumentError, "invalid value for \"close\", must be one of #{allowable_values}"
  end
  pattern = Regexp.new(/[0-9]{4}-[0-9]{2}-[0-9]{2}/)
  if @api_client.config.client_side_validation && !opts[:'from'].nil? && opts[:'from'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"from\"]' when calling CorporationsApi.get_corporations, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/[0-9]{4}-[0-9]{2}-[0-9]{2}/)
  if @api_client.config.client_side_validation && !opts[:'to'].nil? && opts[:'to'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"to\"]' when calling CorporationsApi.get_corporations, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'divide'].nil? && opts[:'divide'] > 99999
    fail ArgumentError, 'invalid value for "opts[:"divide"]" when calling CorporationsApi.get_corporations, must be smaller than or equal to 99999.'
  end

  if @api_client.config.client_side_validation && !opts[:'divide'].nil? && opts[:'divide'] < 1
    fail ArgumentError, 'invalid value for "opts[:"divide"]" when calling CorporationsApi.get_corporations, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/name'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'name'] = name
  query_params[:'type'] = type
  query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?
  query_params[:'target'] = opts[:'target'] if !opts[:'target'].nil?
  query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?
  query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?
  query_params[:'change'] = opts[:'change'] if !opts[:'change'].nil?
  query_params[:'close'] = opts[:'close'] if !opts[:'close'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'divide'] = opts[:'divide'] if !opts[:'divide'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ResponseWrapper'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['id']

  new_options = opts.merge(
    :operation => :"CorporationsApi.get_corporations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CorporationsApi#get_corporations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end