Class: CloudmersiveValidateApiClient::DateTimeApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-validate-api-client/api/date_time_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DateTimeApi



19
20
21
# File 'lib/cloudmersive-validate-api-client/api/date_time_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/cloudmersive-validate-api-client/api/date_time_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#date_time_get_now_simple(opts = {}) ⇒ DateTimeNowResult

Get current date and time as of now Gets the current date and time. Response time is syncronized with atomic clocks, and represents a monotonic, centrally available, consistent clock.



26
27
28
29
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 26

def date_time_get_now_simple(opts = {})
  data, _status_code, _headers = date_time_get_now_simple_with_http_info(opts)
  data
end

#date_time_get_now_simple_with_http_info(opts = {}) ⇒ Array<(DateTimeNowResult, Fixnum, Hash)>

Get current date and time as of now Gets the current date and time. Response time is syncronized with atomic clocks, and represents a monotonic, centrally available, consistent clock.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 35

def date_time_get_now_simple_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DateTimeApi.date_time_get_now_simple ...'
  end
  # resource path
  local_var_path = '/validate/date-time/get/now'

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DateTimeNowResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DateTimeApi#date_time_get_now_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#date_time_get_public_holidays(input, opts = {}) ⇒ PublicHolidaysResponse

Get public holidays in the specified country and year Enumerates all public holidays in a given country for a given year. Supports over 100 countries.



73
74
75
76
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 73

def date_time_get_public_holidays(input, opts = {})
  data, _status_code, _headers = date_time_get_public_holidays_with_http_info(input, opts)
  data
end

#date_time_get_public_holidays_with_http_info(input, opts = {}) ⇒ Array<(PublicHolidaysResponse, Fixnum, Hash)>

Get public holidays in the specified country and year Enumerates all public holidays in a given country for a given year. Supports over 100 countries.



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
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 83

def date_time_get_public_holidays_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DateTimeApi.date_time_get_public_holidays ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling DateTimeApi.date_time_get_public_holidays"
  end
  # resource path
  local_var_path = '/validate/date-time/get/holidays'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PublicHolidaysResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DateTimeApi#date_time_get_public_holidays\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#date_time_parse_natural_language_date_time(input, opts = {}) ⇒ DateTimeStandardizedParseResponse

Parses a free-form natural language date and time string into a date and time Parses an unstructured, free-form, natural language date and time string into a date time object. This is intended for lightweight human-entered input, such as "tomorrow at 3pm" or "tuesday".



127
128
129
130
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 127

def date_time_parse_natural_language_date_time(input, opts = {})
  data, _status_code, _headers = date_time_parse_natural_language_date_time_with_http_info(input, opts)
  data
end

#date_time_parse_natural_language_date_time_with_http_info(input, opts = {}) ⇒ Array<(DateTimeStandardizedParseResponse, Fixnum, Hash)>

Parses a free-form natural language date and time string into a date and time Parses an unstructured, free-form, natural language date and time string into a date time object. This is intended for lightweight human-entered input, such as &quot;tomorrow at 3pm&quot; or &quot;tuesday&quot;.



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
171
172
173
174
175
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 137

def date_time_parse_natural_language_date_time_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DateTimeApi.date_time_parse_natural_language_date_time ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling DateTimeApi.date_time_parse_natural_language_date_time"
  end
  # resource path
  local_var_path = '/validate/date-time/parse/date-time/natural-language'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DateTimeStandardizedParseResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DateTimeApi#date_time_parse_natural_language_date_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#date_time_parse_standard_date_time(input, opts = {}) ⇒ DateTimeStandardizedParseResponse

Parses a standardized date and time string into a date and time Parses a structured date and time string into a date time object. This is intended for standardized date strings that adhere to formatting conventions, rather than natural language input.



181
182
183
184
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 181

def date_time_parse_standard_date_time(input, opts = {})
  data, _status_code, _headers = date_time_parse_standard_date_time_with_http_info(input, opts)
  data
end

#date_time_parse_standard_date_time_with_http_info(input, opts = {}) ⇒ Array<(DateTimeStandardizedParseResponse, Fixnum, Hash)>

Parses a standardized date and time string into a date and time Parses a structured date and time string into a date time object. This is intended for standardized date strings that adhere to formatting conventions, rather than natural language input.



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/cloudmersive-validate-api-client/api/date_time_api.rb', line 191

def date_time_parse_standard_date_time_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DateTimeApi.date_time_parse_standard_date_time ...'
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling DateTimeApi.date_time_parse_standard_date_time"
  end
  # resource path
  local_var_path = '/validate/date-time/parse/date-time/structured'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DateTimeStandardizedParseResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DateTimeApi#date_time_parse_standard_date_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end