mparticle 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +73 -0
- data/docs/ApiResponse.md +8 -0
- data/docs/ApiResponseErrors.md +9 -0
- data/docs/AppEvent.md +18 -0
- data/docs/ApplicationInformation.md +11 -0
- data/docs/ApplicationStateTransitionEvent.md +20 -0
- data/docs/AttributionInfo.md +10 -0
- data/docs/Batch.md +18 -0
- data/docs/BreadcrumbEvent.md +17 -0
- data/docs/CommerceEvent.md +22 -0
- data/docs/CrashReportEvent.md +26 -0
- data/docs/DeviceCurrentState.md +23 -0
- data/docs/DeviceInformation.md +41 -0
- data/docs/EventBase.md +9 -0
- data/docs/EventData.md +15 -0
- data/docs/EventsApi.md +124 -0
- data/docs/FirstRunEvent.md +15 -0
- data/docs/GeoLocation.md +10 -0
- data/docs/MediaInfo.md +15 -0
- data/docs/NetworkPerformanceEvent.md +22 -0
- data/docs/OptOutEvent.md +16 -0
- data/docs/Product.md +19 -0
- data/docs/ProductAction.md +19 -0
- data/docs/ProductImpression.md +9 -0
- data/docs/ProfileEvent.md +18 -0
- data/docs/Promotion.md +11 -0
- data/docs/PromotionAction.md +9 -0
- data/docs/PushMessageEvent.md +22 -0
- data/docs/PushRegistrationEvent.md +17 -0
- data/docs/ScreenViewEvent.md +17 -0
- data/docs/SessionEndEvent.md +16 -0
- data/docs/SessionStartEvent.md +15 -0
- data/docs/ShoppingCart.md +8 -0
- data/docs/SourceInformation.md +11 -0
- data/docs/UserIdentities.md +17 -0
- data/example/main.rb +32 -0
- data/lib/.DS_Store +0 -0
- data/lib/mparticle/.DS_Store +0 -0
- data/lib/mparticle/api/events_api.rb +129 -0
- data/lib/mparticle/api_client.rb +398 -0
- data/lib/mparticle/api_error.rb +26 -0
- data/lib/mparticle/configuration.rb +160 -0
- data/lib/mparticle/models/api_response.rb +178 -0
- data/lib/mparticle/models/api_response_errors.rb +185 -0
- data/lib/mparticle/models/app_event.rb +311 -0
- data/lib/mparticle/models/application_information.rb +203 -0
- data/lib/mparticle/models/application_state_transition_event.rb +352 -0
- data/lib/mparticle/models/attribution_info.rb +209 -0
- data/lib/mparticle/models/batch.rb +348 -0
- data/lib/mparticle/models/breadcrumb_event.rb +269 -0
- data/lib/mparticle/models/commerce_event.rb +306 -0
- data/lib/mparticle/models/crash_report_event.rb +362 -0
- data/lib/mparticle/models/device_current_state.rb +356 -0
- data/lib/mparticle/models/device_information.rb +506 -0
- data/lib/mparticle/models/event_base.rb +228 -0
- data/lib/mparticle/models/event_data.rb +241 -0
- data/lib/mparticle/models/first_run_event.rb +241 -0
- data/lib/mparticle/models/geo_location.rb +204 -0
- data/lib/mparticle/models/media_info.rb +296 -0
- data/lib/mparticle/models/network_performance_event.rb +334 -0
- data/lib/mparticle/models/opt_out_event.rb +255 -0
- data/lib/mparticle/models/product.rb +297 -0
- data/lib/mparticle/models/product_action.rb +330 -0
- data/lib/mparticle/models/product_impression.rb +197 -0
- data/lib/mparticle/models/profile_event.rb +316 -0
- data/lib/mparticle/models/promotion.rb +223 -0
- data/lib/mparticle/models/promotion_action.rb +230 -0
- data/lib/mparticle/models/push_message_event.rb +369 -0
- data/lib/mparticle/models/push_registration_event.rb +269 -0
- data/lib/mparticle/models/screen_view_event.rb +264 -0
- data/lib/mparticle/models/session_end_event.rb +255 -0
- data/lib/mparticle/models/session_start_event.rb +241 -0
- data/lib/mparticle/models/shopping_cart.rb +183 -0
- data/lib/mparticle/models/source_information.rb +246 -0
- data/lib/mparticle/models/user_identities.rb +257 -0
- data/lib/mparticle/version.rb +3 -0
- data/lib/mparticle.rb +61 -0
- data/mparticle.gemspec +19 -0
- metadata +163 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
# MParticle::PushMessageEvent
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**timestamp_unixtime_ms** | **Integer** | | [optional]
|
7
|
+
**event_id** | **Integer** | | [optional]
|
8
|
+
**source_message_id** | **String** | | [optional]
|
9
|
+
**session_id** | **Integer** | | [optional]
|
10
|
+
**session_uuid** | **String** | | [optional]
|
11
|
+
**custom_attributes** | **Hash<String, String>** | | [optional]
|
12
|
+
**location** | [**GeoLocation**](GeoLocation.md) | | [optional]
|
13
|
+
**device_current_state** | [**DeviceCurrentState**](DeviceCurrentState.md) | | [optional]
|
14
|
+
**push_message_token** | **String** | |
|
15
|
+
**push_message_type** | **String** | |
|
16
|
+
**message** | **String** | | [optional]
|
17
|
+
**network** | **String** | | [optional]
|
18
|
+
**push_notification_payload** | **String** | |
|
19
|
+
**application_state** | **String** | |
|
20
|
+
**action_identifier** | **String** | | [optional]
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# MParticle::PushRegistrationEvent
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**timestamp_unixtime_ms** | **Integer** | | [optional]
|
7
|
+
**event_id** | **Integer** | | [optional]
|
8
|
+
**source_message_id** | **String** | | [optional]
|
9
|
+
**session_id** | **Integer** | | [optional]
|
10
|
+
**session_uuid** | **String** | | [optional]
|
11
|
+
**custom_attributes** | **Hash<String, String>** | | [optional]
|
12
|
+
**location** | [**GeoLocation**](GeoLocation.md) | | [optional]
|
13
|
+
**device_current_state** | [**DeviceCurrentState**](DeviceCurrentState.md) | | [optional]
|
14
|
+
**register** | **BOOLEAN** | |
|
15
|
+
**registration_token** | **String** | |
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# MParticle::ScreenViewEvent
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**timestamp_unixtime_ms** | **Integer** | | [optional]
|
7
|
+
**event_id** | **Integer** | | [optional]
|
8
|
+
**source_message_id** | **String** | | [optional]
|
9
|
+
**session_id** | **Integer** | | [optional]
|
10
|
+
**session_uuid** | **String** | | [optional]
|
11
|
+
**custom_attributes** | **Hash<String, String>** | | [optional]
|
12
|
+
**location** | [**GeoLocation**](GeoLocation.md) | | [optional]
|
13
|
+
**device_current_state** | [**DeviceCurrentState**](DeviceCurrentState.md) | | [optional]
|
14
|
+
**screen_name** | **String** | |
|
15
|
+
**activity_type** | **String** | | [optional]
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# MParticle::SessionEndEvent
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**timestamp_unixtime_ms** | **Integer** | | [optional]
|
7
|
+
**event_id** | **Integer** | | [optional]
|
8
|
+
**source_message_id** | **String** | | [optional]
|
9
|
+
**session_id** | **Integer** | | [optional]
|
10
|
+
**session_uuid** | **String** | | [optional]
|
11
|
+
**custom_attributes** | **Hash<String, String>** | | [optional]
|
12
|
+
**location** | [**GeoLocation**](GeoLocation.md) | | [optional]
|
13
|
+
**device_current_state** | [**DeviceCurrentState**](DeviceCurrentState.md) | | [optional]
|
14
|
+
**session_duration_ms** | **Integer** | |
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# MParticle::SessionStartEvent
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**timestamp_unixtime_ms** | **Integer** | | [optional]
|
7
|
+
**event_id** | **Integer** | | [optional]
|
8
|
+
**source_message_id** | **String** | | [optional]
|
9
|
+
**session_id** | **Integer** | | [optional]
|
10
|
+
**session_uuid** | **String** | | [optional]
|
11
|
+
**custom_attributes** | **Hash<String, String>** | | [optional]
|
12
|
+
**location** | [**GeoLocation**](GeoLocation.md) | | [optional]
|
13
|
+
**device_current_state** | [**DeviceCurrentState**](DeviceCurrentState.md) | | [optional]
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# MParticle::SourceInformation
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**channel** | **String** | |
|
7
|
+
**partner** | **String** | |
|
8
|
+
**replay_request_id** | **String** | | [optional]
|
9
|
+
**replay_job_id** | **String** | | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# MParticle::UserIdentities
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**other** | **String** | | [optional]
|
7
|
+
**customerid** | **String** | | [optional]
|
8
|
+
**facebook** | **String** | | [optional]
|
9
|
+
**twitter** | **String** | | [optional]
|
10
|
+
**google** | **String** | | [optional]
|
11
|
+
**microsoft** | **String** | | [optional]
|
12
|
+
**yahoo** | **String** | | [optional]
|
13
|
+
**email** | **String** | | [optional]
|
14
|
+
**_alias** | **String** | | [optional]
|
15
|
+
**facebook_custom_audience_id** | **String** | | [optional]
|
16
|
+
|
17
|
+
|
data/example/main.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby -I../lib
|
2
|
+
|
3
|
+
# load the gem
|
4
|
+
require 'mparticle'
|
5
|
+
config = MParticle::Configuration.new
|
6
|
+
config.api_key = 'REPLACE WITH API KEY'
|
7
|
+
config.api_secret = 'REPLACE WITH API SECRET'
|
8
|
+
# config.debugging = true
|
9
|
+
|
10
|
+
api_instance = MParticle::EventsApi.new(config)
|
11
|
+
|
12
|
+
batch = MParticle::Batch.new
|
13
|
+
batch.environment = 'development'
|
14
|
+
|
15
|
+
app_event = MParticle::AppEvent.new
|
16
|
+
app_event.event_name = 'Test event'
|
17
|
+
app_event.custom_event_type = 'navigation'
|
18
|
+
|
19
|
+
batch.events = [MParticle::SessionStartEvent.new, app_event, MParticle::SessionEndEvent.new]
|
20
|
+
|
21
|
+
begin
|
22
|
+
# send events
|
23
|
+
thread = api_instance.upload_events(batch) { |data, status_code, headers|
|
24
|
+
if status_code == 202
|
25
|
+
puts "Upload complete"
|
26
|
+
end
|
27
|
+
}
|
28
|
+
# wait for the thread, otherwise process may exit too early
|
29
|
+
thread.join
|
30
|
+
rescue MParticle::ApiError => e
|
31
|
+
puts "Exception when calling mParticle: #{e}"
|
32
|
+
end
|
data/lib/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
module MParticle
|
4
|
+
class EventsApi
|
5
|
+
attr_accessor :api_client
|
6
|
+
|
7
|
+
def initialize(configuration)
|
8
|
+
@api_client = ApiClient.new(configuration)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Send events to mParticle
|
12
|
+
#
|
13
|
+
# @param body Up to 100 Batch objects
|
14
|
+
# @param [Hash] opts the optional parameters
|
15
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
16
|
+
def bulk_upload_events(body, opts = {}, &callback)
|
17
|
+
if @api_client.config.debugging
|
18
|
+
@api_client.config.logger.debug "Calling API: EventsApi.bulk_upload_events ..."
|
19
|
+
end
|
20
|
+
# verify the required parameter 'body' is set
|
21
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling EventsApi.bulk_upload_events" if body.nil?
|
22
|
+
# resource path
|
23
|
+
local_var_path = "/bulkevents".sub('{format}','json')
|
24
|
+
|
25
|
+
# query parameters
|
26
|
+
query_params = {}
|
27
|
+
|
28
|
+
# header parameters
|
29
|
+
header_params = {}
|
30
|
+
# HTTP header 'Accept' (if needed)
|
31
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html', 'application/json'])
|
32
|
+
# HTTP header 'Content-Type'
|
33
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
34
|
+
|
35
|
+
# form parameters
|
36
|
+
form_params = {}
|
37
|
+
|
38
|
+
# http body (model)
|
39
|
+
post_body = ApiClient.object_to_json(body)
|
40
|
+
auth_names = ['basic']
|
41
|
+
if (callback.nil?)
|
42
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
43
|
+
:header_params => header_params,
|
44
|
+
:query_params => query_params,
|
45
|
+
:form_params => form_params,
|
46
|
+
:body => post_body,
|
47
|
+
:auth_names => auth_names)
|
48
|
+
if @api_client.config.debugging
|
49
|
+
@api_client.config.logger.debug "API called: EventsApi#bulk_upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
50
|
+
end
|
51
|
+
return data, status_code, headers
|
52
|
+
else
|
53
|
+
thread = @api_client.call_api(:POST, local_var_path,
|
54
|
+
{
|
55
|
+
:header_params => header_params,
|
56
|
+
:query_params => query_params,
|
57
|
+
:form_params => form_params,
|
58
|
+
:body => post_body,
|
59
|
+
:auth_names => auth_names
|
60
|
+
}) { |data, status_code, headers|
|
61
|
+
if @api_client.config.debugging
|
62
|
+
@api_client.config.logger.debug "API called: EventsApi#bulk_upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
63
|
+
end
|
64
|
+
yield data, status_code, headers
|
65
|
+
}
|
66
|
+
return thread
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Send events to mParticle
|
71
|
+
#
|
72
|
+
# @param body Batch of event data
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
75
|
+
def upload_events(body, opts = {}, &callback)
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "Calling API: EventsApi.upload_events ..."
|
78
|
+
end
|
79
|
+
# verify the required parameter 'body' is set
|
80
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling EventsApi.upload_events" if body.nil?
|
81
|
+
# resource path
|
82
|
+
local_var_path = "/events".sub('{format}','json')
|
83
|
+
|
84
|
+
# query parameters
|
85
|
+
query_params = {}
|
86
|
+
|
87
|
+
# header parameters
|
88
|
+
header_params = {}
|
89
|
+
# HTTP header 'Accept' (if needed)
|
90
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html', 'application/json'])
|
91
|
+
# HTTP header 'Content-Type'
|
92
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
93
|
+
|
94
|
+
# form parameters
|
95
|
+
form_params = {}
|
96
|
+
|
97
|
+
# http body (model)
|
98
|
+
post_body = ApiClient.object_to_json(body)
|
99
|
+
auth_names = ['basic']
|
100
|
+
if (callback.nil?)
|
101
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
102
|
+
:header_params => header_params,
|
103
|
+
:query_params => query_params,
|
104
|
+
:form_params => form_params,
|
105
|
+
:body => post_body,
|
106
|
+
:auth_names => auth_names)
|
107
|
+
if @api_client.config.debugging
|
108
|
+
@api_client.config.logger.debug "API called: EventsApi#upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
109
|
+
end
|
110
|
+
return data, status_code, headers
|
111
|
+
else
|
112
|
+
thread = @api_client.call_api(:POST, local_var_path,
|
113
|
+
{
|
114
|
+
:header_params => header_params,
|
115
|
+
:query_params => query_params,
|
116
|
+
:form_params => form_params,
|
117
|
+
:body => post_body,
|
118
|
+
:auth_names => auth_names
|
119
|
+
}) { |data, status_code, headers|
|
120
|
+
if @api_client.config.debugging
|
121
|
+
@api_client.config.logger.debug "API called: EventsApi#upload_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
122
|
+
end
|
123
|
+
yield data, status_code, headers
|
124
|
+
}
|
125
|
+
return thread
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|