Skip to content

Commit

Permalink
Merge pull request #8 from Moesif/add-weight-field-to-event
Browse files Browse the repository at this point in the history
Add: weight field to Event Model
  • Loading branch information
xinghengwang authored Dec 18, 2019
2 parents a0484fc + 31a36b6 commit c52aa54
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
moesif_api (1.2.10)
moesif_api (1.2.11)
json_mapper (~> 0.2.1)
moesif_unirest (~> 1.1.5)
test-unit (~> 3.1.5)
Expand All @@ -16,7 +16,7 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
json (2.2.0)
json (2.3.0)
json_mapper (0.2.1)
json (>= 1.4.3)
mime-types (3.3)
Expand Down
2 changes: 1 addition & 1 deletion lib/moesif_api/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Configuration
# Your Application Id for authentication/authorization
@application_id = 'SET_ME'

@version = '1.2.10'
@version = '1.2.11'

# create the getters and setters
class << self
Expand Down
13 changes: 11 additions & 2 deletions lib/moesif_api/models/event_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class EventModel < BaseModel
# @return [String]
attr_accessor :direction

# Weight of an API call
# @return [Integer]
attr_accessor :weight

# A mapping from model property names to API property names
def self.names
if @hash.nil?
Expand All @@ -46,6 +50,7 @@ def self.names
@hash["company_id"] = "company_id"
@hash["metadata"] = "metadata"
@hash["direction"] = "direction"
@hash["weight"] = "weight"
end
@hash
end
Expand All @@ -57,7 +62,8 @@ def initialize(request = nil,
user_id = nil,
company_id = nil,
metadata = nil,
direction = nil)
direction = nil,
weight = nil)
@request = request
@response = response
@session_token = session_token
Expand All @@ -66,6 +72,7 @@ def initialize(request = nil,
@company_id = company_id
@metadata = metadata
@direction = direction
@weight = weight
end

# Creates an instance of the object from a hash
Expand All @@ -82,6 +89,7 @@ def self.from_hash(hash)
company_id = hash["company_id"]
metadata = hash["metadata"]
direction = hash["direction"]
weight = hash["weight"]

# Create object from extracted values
EventModel.new(request,
Expand All @@ -91,7 +99,8 @@ def self.from_hash(hash)
user_id,
company_id,
metadata,
direction)
direction,
weight)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion moesif_api.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'moesif_api'
s.version = '1.2.10'
s.version = '1.2.11'
s.summary = 'moesif_api'
s.description = 'Collection/Data Ingestion API'
s.authors = ['Moesif, Inc', 'Derric Gilling']
Expand Down

0 comments on commit c52aa54

Please sign in to comment.