fomo 0.0.6 → 0.0.7
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 +4 -4
- data/lib/fomo.rb +7 -5
- metadata +2 -3
- data/lib/fomo_event_basic.rb +0 -87
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5000c3af381659f382200200f4ae6d024c90a455
|
4
|
+
data.tar.gz: 7886ebeb89ea3fb504d0b8562995932230f1e83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8344bef3b9af01798175f17c647e2183cde0350652bf724e3fdada91e2c328d3de94d740233654bd7cbac9e5f9a410e7dff09fda54dfb6fe74269d5bed150b4
|
7
|
+
data.tar.gz: eb72dc0fd7989e70fcb1962b3850cc96f13f82db99ad724e937a98826582ba3dd45fb8bbc503315d0868842d0becd4c1e828629aec5e3a44f0217a1054328002
|
data/lib/fomo.rb
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
require 'net/https'
|
8
8
|
require 'json'
|
9
|
-
require 'fomo_event_basic'
|
10
9
|
require 'fomo_event'
|
11
10
|
require 'fomo_delete_message_response'
|
12
11
|
require 'fomo_meta_data'
|
@@ -98,11 +97,13 @@ class Fomo
|
|
98
97
|
# Create event
|
99
98
|
#
|
100
99
|
# Arguments:
|
101
|
-
# event: (
|
100
|
+
# event: (FomoEvent) Fomo event
|
102
101
|
# event_type_id: (String) Event type ID
|
103
102
|
# event_type_tag: (String) Event type tag
|
104
103
|
# url: (String) Event URL
|
105
104
|
# first_name: (String) First name
|
105
|
+
# email_address: (String) Email address
|
106
|
+
# ip_address: (String) IP address
|
106
107
|
# city: (String) City
|
107
108
|
# province: (String) Province
|
108
109
|
# country: (String) Country
|
@@ -112,9 +113,10 @@ class Fomo
|
|
112
113
|
#
|
113
114
|
# Returns an FomoEvent object.
|
114
115
|
#
|
115
|
-
def create_event(event=
|
116
|
-
if event ==
|
117
|
-
|
116
|
+
def create_event(event={})
|
117
|
+
if event == {}
|
118
|
+
puts "No event provided - please provide a FomoEvent object or hash of parameters"
|
119
|
+
return
|
118
120
|
end
|
119
121
|
|
120
122
|
response = make_request('/api/v1/applications/me/events', 'POST', event)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fomo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Fomo Ruby SDK is the official SDK wrapper for the Fomo API service
|
15
15
|
email:
|
@@ -21,7 +21,6 @@ files:
|
|
21
21
|
- lib/fomo.rb
|
22
22
|
- lib/fomo_delete_message_response.rb
|
23
23
|
- lib/fomo_event.rb
|
24
|
-
- lib/fomo_event_basic.rb
|
25
24
|
- lib/fomo_events_with_meta.rb
|
26
25
|
- lib/fomo_meta_data.rb
|
27
26
|
homepage: https://github.com/usefomo/fomo-ruby-sdk
|
data/lib/fomo_event_basic.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# Copyright (c) 2017. Fomo. https://www.usefomo.com
|
2
|
-
#
|
3
|
-
# Author:: Fomo (mailto:hello@usefomo.com)
|
4
|
-
# Copyright:: Copyright (c) 2017. Fomo. https://www.usefomo.com
|
5
|
-
# License:: MIT
|
6
|
-
|
7
|
-
require 'json'
|
8
|
-
|
9
|
-
# This class holds attributes of basic event, object is needed when creating new event
|
10
|
-
class FomoEventBasic
|
11
|
-
|
12
|
-
# Event type unique ID (optional|required if event_type_tag = '')
|
13
|
-
attr_accessor :event_type_id
|
14
|
-
|
15
|
-
# Event type unique ID (optional|required if event_type_id = '')
|
16
|
-
attr_accessor :event_type_tag
|
17
|
-
|
18
|
-
# Url to redirect on the event click. Size range: 0..255 (required)
|
19
|
-
attr_accessor :url
|
20
|
-
|
21
|
-
# First name of the person on the event. Size range: 0..255
|
22
|
-
attr_accessor :first_name
|
23
|
-
|
24
|
-
# Email address of the person on the event. Size range: 0..255
|
25
|
-
attr_accessor :email_address
|
26
|
-
|
27
|
-
# IP address of the person on the event. Size range: 0..255
|
28
|
-
attr_accessor :ip_address
|
29
|
-
|
30
|
-
# City where the event happened. Size range: 0..255
|
31
|
-
attr_accessor :city
|
32
|
-
|
33
|
-
# Province where the event happened. Size range: 0..255
|
34
|
-
attr_accessor :province
|
35
|
-
|
36
|
-
# Country where the event happened ISO-2 standard. Size range: 0..255
|
37
|
-
attr_accessor :country
|
38
|
-
|
39
|
-
# Title of the event. Size range: 0..255
|
40
|
-
attr_accessor :title
|
41
|
-
|
42
|
-
# Url of the image to be displayed. Size range: 0..255
|
43
|
-
attr_accessor :image_url
|
44
|
-
|
45
|
-
# Array to create custom event fields
|
46
|
-
attr_accessor :custom_event_fields_attributes
|
47
|
-
|
48
|
-
# Initializes FomoEventBasic object
|
49
|
-
def initialize(event_type_id='', event_type_tag='', url='', first_name='', email_address='', ip_address='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes = [])
|
50
|
-
@event_type_id = event_type_id
|
51
|
-
@event_type_tag = event_type_tag
|
52
|
-
@url = url
|
53
|
-
@first_name = first_name
|
54
|
-
@email_address = email_address
|
55
|
-
@ip_address = ip_address
|
56
|
-
@city = city
|
57
|
-
@province = province
|
58
|
-
@country = country
|
59
|
-
@title = title
|
60
|
-
@image_url = image_url
|
61
|
-
@custom_event_fields_attributes = custom_event_fields_attributes
|
62
|
-
end
|
63
|
-
|
64
|
-
# Add custom event field
|
65
|
-
#
|
66
|
-
# Arguments:
|
67
|
-
# key: Custom attribute key
|
68
|
-
# value: Custom attribute value
|
69
|
-
# id: Custom attribute ID
|
70
|
-
#
|
71
|
-
def add_custom_event_field(key, value, id='')
|
72
|
-
if id == ''
|
73
|
-
@custom_event_fields_attributes.push({'key' => key, 'value' => value})
|
74
|
-
else
|
75
|
-
@custom_event_fields_attributes.push({'key' => key, 'value' => value, 'id' => id})
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# Return JSON serialized object
|
80
|
-
def to_json
|
81
|
-
hash = {}
|
82
|
-
self.instance_variables.each do |var|
|
83
|
-
hash[var.to_s.sub(/^@/, '')] = self.instance_variable_get var
|
84
|
-
end
|
85
|
-
'{"event":' + hash.to_json + '}'
|
86
|
-
end
|
87
|
-
end
|