Class: MParticle::EventsApi
- Inherits:
-
Object
- Object
- MParticle::EventsApi
- Defined in:
- lib/mparticle/api/events_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#bulk_upload_events(body, opts = {}, &callback) ⇒ Array<(nil, Fixnum, Hash)>
Send events to mParticle.
-
#initialize(configuration) ⇒ EventsApi
constructor
A new instance of EventsApi.
-
#upload_events(body, opts = {}, &callback) ⇒ Array<(nil, Fixnum, Hash)>
Send events to mParticle.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/mparticle/api/events_api.rb', line 5 def api_client @api_client end |
Instance Method Details
#bulk_upload_events(body, opts = {}, &callback) ⇒ Array<(nil, Fixnum, Hash)>
Send events to mParticle
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 68 |
# File 'lib/mparticle/api/events_api.rb', line 16 def bulk_upload_events(body, opts = {}, &callback) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EventsApi.bulk_upload_events ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling EventsApi.bulk_upload_events" if body.nil? # resource path local_var_path = "/bulkevents".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/html', '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 = ApiClient.object_to_json(body) auth_names = ['basic'] if (callback.nil?) 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#bulk_upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers else thread = @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 }) { |data, status_code, headers| if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#bulk_upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end yield data, status_code, headers } return thread end end |
#upload_events(body, opts = {}, &callback) ⇒ Array<(nil, Fixnum, Hash)>
Send events to mParticle
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 |
# File 'lib/mparticle/api/events_api.rb', line 75 def upload_events(body, opts = {}, &callback) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EventsApi.upload_events ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling EventsApi.upload_events" if body.nil? # resource path local_var_path = "/events".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/html', '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 = ApiClient.object_to_json(body) auth_names = ['basic'] if (callback.nil?) 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers else thread = @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 }) { |data, status_code, headers| if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsApi#upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end yield data, status_code, headers } return thread end end |