fomo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dcc514f4a284cc788137ac76d83d20f974ad28d6
4
- data.tar.gz: 147477b80dc9f899dfd97fff0ff0f3d5e9d83190
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjBmZjZhZmQ0MWVjMmJlYjhlZmFkZDU3NDdmYWVhYjdkN2QxZDBkMA==
5
+ data.tar.gz: !binary |-
6
+ Yzc5ZDU0Njk2N2QyZTA0YmQ0ZGJiYTFiMDc4YjRmODc4NjM4NTNmNg==
5
7
  SHA512:
6
- metadata.gz: dffb6233fb5dc77332d5057fabbf37d3dc99005b8f56d8d3a05f81d6a2ca0495b708c46a218bdfd254210a30a6505cc377cc97b9f76ef5f97c8e4c7f17f35bca
7
- data.tar.gz: 03d7f8c4a103c153815287b715935694b92466750dc642b477e66b8ab2909f599108d820ae26378c512a0675562c2d6ab28ec0d00e440efeb70e55659b845671
8
+ metadata.gz: !binary |-
9
+ NGIwNmJhODlhZmFhODMxMmEwNjUwY2I1OGNjYmUwNDMyNmVhMWY4ZTg5ZjI1
10
+ YTdjMWIyNDcwMmFiZjRiNjIwZWNmM2RhNTUzYjM3MWI4ODI4NmQ3NjQ3MWQy
11
+ MTEzNzdhMWNlOGIyNGJhZDdiNmEwOTgxZmE4NGEyOTNkMzYyODc=
12
+ data.tar.gz: !binary |-
13
+ ZWE1NjQ5MzZiN2VkMTk4MmM2NTNhZThlMjM4ZDJlMGJkZjQ4Yzc3MTRmYWY2
14
+ YThjMmRlODc0NjVjMDRhMzlmN2ZhMzllMDM2YjU1ZjQzYjY2MTRiMTc3NjM1
15
+ NGYyNzY4ODUyNGRkZDM3NzZhMjJjNjZjN2Q4M2MxNmUwNTE2NzI=
data/lib/fomo.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Copyright:: Copyright (c) 2016. Fomo. https://www.usefomo.com
5
5
  # License:: MIT
6
6
 
7
- require 'net/http'
7
+ require 'net/https'
8
8
  require 'json'
9
9
  require 'fomo_event_basic'
10
10
  require 'fomo_event'
@@ -40,7 +40,7 @@ class Fomo
40
40
  response = make_request('/api/v1/applications/me/events/' + id.to_s, 'GET')
41
41
  begin
42
42
  j = JSON.parse(response)
43
- FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
43
+ FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['event_type_tag'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
44
44
  rescue JSON::ParserError => _
45
45
  # String was not valid
46
46
  end
@@ -56,7 +56,7 @@ class Fomo
56
56
  data = JSON.parse(response)
57
57
  list = []
58
58
  data.each do |j|
59
- list.push(FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes']))
59
+ list.push(FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['event_type_tag'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes']))
60
60
  end
61
61
  list
62
62
  rescue JSON::ParserError => _
@@ -69,6 +69,7 @@ class Fomo
69
69
  # Arguments:
70
70
  # event: (FomoEventBasic) Fomo event
71
71
  # event_type_id: (String) Event type ID
72
+ # event_type_tag: (String) Event type tag
72
73
  # url: (String) Event URL
73
74
  # first_name: (String) First name
74
75
  # city: (String) City
@@ -80,15 +81,15 @@ class Fomo
80
81
  #
81
82
  # Returns an FomoEvent object.
82
83
  #
83
- def create_event(event=nil, event_type_id='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes=[])
84
+ def create_event(event=nil, event_type_id='', event_type_tag='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes=[])
84
85
  if event == nil
85
- event = FomoEventBasic.new(event_type_id, url, first_name, city, province, country, title, image_url, custom_event_fields_attributes)
86
+ event = FomoEventBasic.new(event_type_id, event_type_tag, url, first_name, city, province, country, title, image_url, custom_event_fields_attributes)
86
87
  end
87
88
 
88
89
  response = make_request('/api/v1/applications/me/events', 'POST', event)
89
90
  begin
90
91
  j = JSON.parse(response)
91
- FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
92
+ FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['event_type_tag'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
92
93
  rescue JSON::ParserError => _
93
94
  # String was not valid
94
95
  end
@@ -122,7 +123,7 @@ class Fomo
122
123
  response = make_request('/api/v1/applications/me/events/' + event.id.to_s, 'PATCH', event)
123
124
  begin
124
125
  j = JSON.parse(response)
125
- FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
126
+ FomoEvent.new(j['id'], j['created_at'], j['updated_at'], j['message'], j['link'], j['event_type_id'], j['event_type_tag'], j['url'], j['first_name'], j['city'], j['province'], j['country'], j['title'], j['image_url'], j['custom_event_fields_attributes'])
126
127
  rescue JSON::ParserError => _
127
128
  # String was not valid
128
129
  end
@@ -138,7 +139,6 @@ class Fomo
138
139
  # Returns an JSON string.
139
140
  #
140
141
  def make_request(api_path, method, data = nil)
141
- # puts(method + ' ' + @endpoint + api_path)
142
142
  uri = URI.parse(@endpoint + api_path)
143
143
  http = Net::HTTP.new(uri.host, uri.port)
144
144
  http.use_ssl = true
data/lib/fomo_event.rb CHANGED
@@ -23,9 +23,12 @@ class FomoEvent
23
23
  # Full link
24
24
  attr_accessor :link
25
25
 
26
- # Event type unique ID (required)
26
+ # Event type unique ID (optional|required if event_type_tag = '')
27
27
  attr_accessor :event_type_id
28
28
 
29
+ # Event type unique ID (optional|required if event_type_id = '')
30
+ attr_accessor :event_type_tag
31
+
29
32
  # Url to redirect on the event click. Size range: 0..255 (required)
30
33
  attr_accessor :url
31
34
 
@@ -51,13 +54,14 @@ class FomoEvent
51
54
  attr_accessor :custom_event_fields_attributes
52
55
 
53
56
  # Initializes FomoEvent object
54
- def initialize(id='', created_at='', updated_at='', message='', link='', event_type_id='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes = [])
57
+ def initialize(id='', created_at='', updated_at='', message='', link='', event_type_id='', event_type_tag='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes = [])
55
58
  @id = id
56
59
  @created_at = created_at
57
60
  @updated_at = updated_at
58
61
  @message = message
59
62
  @link = link
60
63
  @event_type_id = event_type_id
64
+ @event_type_tag = event_type_tag
61
65
  @url = url
62
66
  @first_name = first_name
63
67
  @city = city
@@ -9,9 +9,12 @@ require 'json'
9
9
  # This class holds attributes of basic event, object is needed when creating new event
10
10
  class FomoEventBasic
11
11
 
12
- # Event type unique ID (required)
12
+ # Event type unique ID (optional|required if event_type_tag = '')
13
13
  attr_accessor :event_type_id
14
14
 
15
+ # Event type unique ID (optional|required if event_type_id = '')
16
+ attr_accessor :event_type_tag
17
+
15
18
  # Url to redirect on the event click. Size range: 0..255 (required)
16
19
  attr_accessor :url
17
20
 
@@ -37,8 +40,9 @@ class FomoEventBasic
37
40
  attr_accessor :custom_event_fields_attributes
38
41
 
39
42
  # Initializes FomoEventBasic object
40
- def initialize(event_type_id='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes = [])
43
+ def initialize(event_type_id='', event_type_tag='', url='', first_name='', city='', province='', country='', title='', image_url='', custom_event_fields_attributes = [])
41
44
  @event_type_id = event_type_id
45
+ @event_type_tag = event_type_tag
42
46
  @url = url
43
47
  @first_name = first_name
44
48
  @city = city
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fomo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-17 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fomo Ruby SDK is the official SDK wrapper for the Fomo API service
14
14
  email:
@@ -31,17 +31,17 @@ require_paths:
31
31
  - lib
32
32
  required_ruby_version: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ! '>='
35
35
  - !ruby/object:Gem::Version
36
- version: '2.0'
36
+ version: '1.9'
37
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - ! '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.5.1
44
+ rubygems_version: 2.4.8
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Fomo