Class: RadioManagerClient::ModelTypeApi

Inherits:
Object
  • Object
show all
Defined in:
lib/radiomanager_client/api/model_type_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ModelTypeApi

Returns a new instance of ModelTypeApi.



19
20
21
# File 'lib/radiomanager_client/api/model_type_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/radiomanager_client/api/model_type_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_model_type_by_id(id, opts = {}) ⇒ ModelTypeResult

Get modelType by id Get modelType by id

Parameters:

  • id

    ID of ModelType **(Required)**

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:



29
30
31
32
# File 'lib/radiomanager_client/api/model_type_api.rb', line 29

def get_model_type_by_id(id, opts = {})
  data, _status_code, _headers = get_model_type_by_id_with_http_info(id, opts)
  return data
end

#get_model_type_by_id_with_http_info(id, opts = {}) ⇒ Array<(ModelTypeResult, Fixnum, Hash)>

Get modelType by id Get modelType by id

Parameters:

  • id

    ID of ModelType **(Required)**

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:

  • (Array<(ModelTypeResult, Fixnum, Hash)>)

    ModelTypeResult data, response status code and response headers



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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/radiomanager_client/api/model_type_api.rb', line 40

def get_model_type_by_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ModelTypeApi.get_model_type_by_id ..."
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ModelTypeApi.get_model_type_by_id"
  end
  if @api_client.config.client_side_validation && id < 0
    fail ArgumentError, 'invalid value for "id" when calling ModelTypeApi.get_model_type_by_id, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = "/model_types/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API Key']
  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 => 'ModelTypeResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ModelTypeApi#get_model_type_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_model_types(opts = {}) ⇒ ModelTypeResults

Get all modelTypes. List all modelTypes.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Current page *(Optional)*

  • :program_id (Integer)

    Search on Program ID *(Optional)*

  • :broadcast_id (Integer)

    Search on Broadcast ID *(Optional)*

  • :item_id (Integer)

    Search on Item ID *(Optional)*

  • :campaign_id (Integer)

    Search on Campaign ID *(Optional)*

  • :presenter_id (Integer)

    Search on Presenter ID *(Optional)*

  • :contact_id (Integer)

    Search on Contact ID *(Optional)*

  • :model (String)

    Search Modeltypes for certain Model *(Optional)*

  • :limit (Integer)

    Results per page *(Optional)*

  • :order_by (String)

    Field to order the results *(Optional)*

  • :order_direction (String)

    Direction of ordering *(Optional)*

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:



101
102
103
104
# File 'lib/radiomanager_client/api/model_type_api.rb', line 101

def list_model_types(opts = {})
  data, _status_code, _headers = list_model_types_with_http_info(opts)
  return data
end

#list_model_types_with_http_info(opts = {}) ⇒ Array<(ModelTypeResults, Fixnum, Hash)>

Get all modelTypes. List all modelTypes.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Current page *(Optional)*

  • :program_id (Integer)

    Search on Program ID *(Optional)*

  • :broadcast_id (Integer)

    Search on Broadcast ID *(Optional)*

  • :item_id (Integer)

    Search on Item ID *(Optional)*

  • :campaign_id (Integer)

    Search on Campaign ID *(Optional)*

  • :presenter_id (Integer)

    Search on Presenter ID *(Optional)*

  • :contact_id (Integer)

    Search on Contact ID *(Optional)*

  • :model (String)

    Search Modeltypes for certain Model *(Optional)*

  • :limit (Integer)

    Results per page *(Optional)*

  • :order_by (String)

    Field to order the results *(Optional)*

  • :order_direction (String)

    Direction of ordering *(Optional)*

  • :_external_station_id (Integer)

    Query on a different (content providing) station *(Optional)*

Returns:

  • (Array<(ModelTypeResults, Fixnum, Hash)>)

    ModelTypeResults data, response status code and response headers



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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/radiomanager_client/api/model_type_api.rb', line 122

def list_model_types_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ModelTypeApi.list_model_types ..."
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ModelTypeApi.list_model_types, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'model'] && !['broadcast', 'program', 'item', 'campaign', 'presenter', 'contact', 'external'].include?(opts[:'model'])
    fail ArgumentError, 'invalid value for "model", must be one of broadcast, program, item, campaign, presenter, contact, external'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ModelTypeApi.list_model_types, must be smaller than or equal to 50.'
  end

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

  if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
    fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
  end
  # resource path
  local_var_path = "/model_types"

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'program_id'] = opts[:'program_id'] if !opts[:'program_id'].nil?
  query_params[:'broadcast_id'] = opts[:'broadcast_id'] if !opts[:'broadcast_id'].nil?
  query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?
  query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
  query_params[:'presenter_id'] = opts[:'presenter_id'] if !opts[:'presenter_id'].nil?
  query_params[:'contact_id'] = opts[:'contact_id'] if !opts[:'contact_id'].nil?
  query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['API Key']
  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 => 'ModelTypeResults')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ModelTypeApi#list_model_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end