Class: KoronaEntryClient::StatisticsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/korona-entry-client/api/statistics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ StatisticsApi

Returns a new instance of StatisticsApi.



19
20
21
# File 'lib/korona-entry-client/api/statistics_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/korona-entry-client/api/statistics_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#load_grouped_entries(client, time_from, time_to, ticket_type, grouped_entries_type, opts = {}) ⇒ Array<StatisticGroupedEntry>

Prepares entries statistically and returns them as a list.

Parameters:

  • client (String)

    Identification of executing client.

  • time_from (DateTime)

    Log time from.

  • time_to (DateTime)

    Log time to.

  • ticket_type (String)
  • grouped_entries_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organizational_unit_numbers (Array<String>)
  • :tags (Array<String>)

Returns:



32
33
34
35
# File 'lib/korona-entry-client/api/statistics_api.rb', line 32

def load_grouped_entries(client, time_from, time_to, ticket_type, grouped_entries_type, opts = {})
  data, _status_code, _headers = load_grouped_entries_with_http_info(client, time_from, time_to, ticket_type, grouped_entries_type, opts)
  data
end

#load_grouped_entries_with_http_info(client, time_from, time_to, ticket_type, grouped_entries_type, opts = {}) ⇒ Array<(Array<StatisticGroupedEntry>, Integer, Hash)>

Prepares entries statistically and returns them as a list.

Parameters:

  • client (String)

    Identification of executing client.

  • time_from (DateTime)

    Log time from.

  • time_to (DateTime)

    Log time to.

  • ticket_type (String)
  • grouped_entries_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :organizational_unit_numbers (Array<String>)
  • :tags (Array<String>)

Returns:

  • (Array<(Array<StatisticGroupedEntry>, Integer, Hash)>)

    Array<StatisticGroupedEntry> data, response status code and response headers



47
48
49
50
51
52
53
54
55
56
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
# File 'lib/korona-entry-client/api/statistics_api.rb', line 47

def load_grouped_entries_with_http_info(client, time_from, time_to, ticket_type, grouped_entries_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatisticsApi.load_grouped_entries ...'
  end
  # verify the required parameter 'client' is set
  if @api_client.config.client_side_validation && client.nil?
    fail ArgumentError, "Missing the required parameter 'client' when calling StatisticsApi.load_grouped_entries"
  end
  # verify the required parameter 'time_from' is set
  if @api_client.config.client_side_validation && time_from.nil?
    fail ArgumentError, "Missing the required parameter 'time_from' when calling StatisticsApi.load_grouped_entries"
  end
  # verify the required parameter 'time_to' is set
  if @api_client.config.client_side_validation && time_to.nil?
    fail ArgumentError, "Missing the required parameter 'time_to' when calling StatisticsApi.load_grouped_entries"
  end
  # verify the required parameter 'ticket_type' is set
  if @api_client.config.client_side_validation && ticket_type.nil?
    fail ArgumentError, "Missing the required parameter 'ticket_type' when calling StatisticsApi.load_grouped_entries"
  end
  # verify enum value
  allowable_values = ["ALL_TICKETS", "INTERNAL_TICKETS", "EXTERNAL_TICKETS"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ticket_type)
    fail ArgumentError, "invalid value for \"ticket_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'grouped_entries_type' is set
  if @api_client.config.client_side_validation && grouped_entries_type.nil?
    fail ArgumentError, "Missing the required parameter 'grouped_entries_type' when calling StatisticsApi.load_grouped_entries"
  end
  # verify enum value
  allowable_values = ["DAY", "DAY_UNIQUE_TICKETS", "HOUR", "ENTRY_GATES"]
  if @api_client.config.client_side_validation && !allowable_values.include?(grouped_entries_type)
    fail ArgumentError, "invalid value for \"grouped_entries_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/{client}/statistics/groupedEntries'.sub('{' + 'client' + '}', CGI.escape(client.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'timeFrom'] = time_from
  query_params[:'timeTo'] = time_to
  query_params[:'ticketType'] = ticket_type
  query_params[:'groupedEntriesType'] = grouped_entries_type
  query_params[:'organizationalUnitNumbers'] = @api_client.build_collection_param(opts[:'organizational_unit_numbers'], :multi) if !opts[:'organizational_unit_numbers'].nil?
  query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?

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

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

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

  # return_type
  return_type = opts[:return_type] || 'Array<StatisticGroupedEntry>' 

  # auth_names
  auth_names = opts[:auth_names] || []

  new_options = opts.merge(
    :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: StatisticsApi#load_grouped_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end