8000 feat(epmodel): Event Processor datamodel by msohailhussain · Pull Request #184 · optimizely/ruby-sdk · GitHub
[go: up one dir, main page]

Skip to content

feat(epmodel): Event Processor datamodel #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changes attributes
  • Loading branch information
rashidsp committed Jul 22, 2019
commit f3df881135082f424d6ac58a49b0ed77f11322b9
18 changes: 17 additions & 1 deletion lib/optimizely/event/entity/conversion_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
require_relative 'user_event'
module Optimizely
class ConversionEvent < UserEvent
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are other attributes?
bot filter?

attr_reader :event, :event_tags, :user_id, :visitor_attributes, :bot_filtering
attr_reader :event_context, :event, :user_id, :visitor_attributes, :tags, :bot_filtering

def initialize(
event_context,
event,
user_id,
visitor_attributes,
tags,
bot_filtering = nil
)
@event_context = event_context
@event = event
@user_id = user_id
@visitor_attributes = visitor_attributes
@tags = tags
@bot_filtering = bot_filtering
end
end
end
3 changes: 1 addition & 2 deletions lib/optimizely/event/entity/decision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Optimizely
class Decision
attr_reader :campaign_id, :experiment_id, :variation_id
Expand All @@ -26,7 +25,7 @@ def initialize(campaign_id, experiment_id, variation_id)
@variation_id = variation_id
end

def as_json(_options = {})
def as_json
{
campaign_id: @campaign_id,
experiment_id: @experiment_id,
Expand Down
4 changes: 1 addition & 3 deletions lib/optimizely/event/entity/event_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'json'
module Optimizely
class EventBatch
attr_accessor :account_id, :project_id, :revision, :client_name, :client_version,
:anonymize_ip, :enrich_decisions, :visitors

def as_json(_options = {})
def as_json
{
account_id: @account_id,
project_id: @project_id,
Expand Down
22 changes: 17 additions & 5 deletions lib/optimizely/event/entity/event_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Optimizely
class EventContext
protected

attr_accessor :account_id, :project_id, :revision, :client_name,
:client_version, :anonymize_ip
attr_reader :account_id, :project_id, :revision, :client_name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how you will set these values?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialized

:client_version, :anonymize_ip
def initialize(
account_id,
project_id,
revision,
client_name,
client_version,
anonymize_ip
)
@account_id = account_id
@project_id = project_id
@revision = revision
@client_name = client_name
@client_version = client_version
@anonymize_ip = anonymize_ip
end
end
end
20 changes: 18 additions & 2 deletions lib/optimizely/event/entity/impression_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@
require_relative 'user_event'
module Optimizely
class ImpressionEvent < UserEvent
attr_reader :user_id, :visitor_attributes
attr_accessor :experiment, :variation, :bot_filtering
attr_reader :event_context, :user_id, :experiment, :variation, :visitor_attributes,
:bot_filtering

def initialize(
event_context,
user_id,
experiment,
< 10000 /td> variation,
visitor_attributes,
bot_filtering
)
@event_context = event_context
@user_id = user_id
@experiment = experiment
@variation = variation
@visitor_attributes = visitor_attributes
@bot_filtering = bot_filtering
end
end
end
2 changes: 1 addition & 1 deletion lib/optimizely/event/entity/snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(events, decisions = nil)
@events = events
end

def as_json(_options = {})
def as_json
hash = {
events: @events,
decisions: @decisions
Expand Down
2 changes: 1 addition & 1 deletion lib/optimizely/event/entity/snapshot_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def initialize(
@tags = tags
end

def as_json(_options = {})
def as_json
hash = {
entity_id: @entity_id,
uuid: @uuid,
Expand Down
4 changes: 1 addition & 3 deletions lib/optimizely/event/entity/user_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#
module Optimizely
class UserEvent
protected

attr_accessor :event_context, :uuid, :timestamp
attr_reader :event_context, :uuid, :timestamp
end
end
2 changes: 1 addition & 1 deletion lib/optimizely/event/entity/visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(snapshots, attributes, visitor_id)
@visitor_id = visitor_id
end

def as_json(_options = {})
def as_json
{
snapshots: @snapshots,
attributes: @attributes,
Expand Down
2 changes: 1 addition & 1 deletion lib/optimizely/event/entity/visitor_attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize(entity_id, key, type, value)
@value = value
end

def as_json(_options = {})
def as_json
{
entity_id: @entity_id,
key: @key,
Expand Down
0