seekr-ruby 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2702b21ccb5e5c2a221ebe11a1928e8edb4006c
4
- data.tar.gz: 6737c33c134d4fc089707c9e9cd5aba017748707
3
+ metadata.gz: e627af6d9063d2779d9711cfa7a2201b7041f6ba
4
+ data.tar.gz: 94e42664d079ae422ab22a8a62109f7214f53ee8
5
5
  SHA512:
6
- metadata.gz: 34306866f588550c3c78f71101e94c785cdf1c1d5437140e2904233ec4e5a4b6ce91682018f5e4139a50ad1b52abd7c5e95dbecfb66d8455d1974c443f3e774d
7
- data.tar.gz: fd71d4da8b550e7e3c92d41703d8017b507a981b5f2b9740d6e0c3e9c9afa71d5b91463bfcd2a8b2b01d5d47ce5ea1991c45286eb956d5dbffc2bea6eb938fa8
6
+ metadata.gz: d5b6f00a2ace3f37e045de2c9d5cb3ab1a7b9f7305bb52b04b7e21c70b7d94c0338a9328e3172ff8c38106a03354feace49eec0087d478e0a98477eed277bc6f
7
+ data.tar.gz: 330564adc15ca8f0e332ea2d1aa17e6f6f5ac868ef9317a8179a27766e1168c7ec8c5272d906da14f34de1fc3c712d15e16d14760de50015fa9a3a6f18ef9b05
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.2.2
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.0"
4
- - "1.9.3"
3
+ - 2.2.2
4
+ - 1.9.3
5
5
 
6
6
  addons:
7
7
  code_climate:
data/README.md CHANGED
@@ -34,6 +34,82 @@ Seekr.configure do |config|
34
34
  config.api_secret = "<API-SECRET>"
35
35
  end
36
36
  ```
37
+ ### Getting all monitor occurrences
38
+
39
+ Run:
40
+
41
+ ```ruby
42
+ occurrence = Seekr::Occurrence.new(12345)
43
+ occurrence.all_paginated
44
+ ```
45
+
46
+ It results:
47
+
48
+ ```json
49
+ {
50
+ "response": {
51
+ "status": "200 OK",
52
+ "code": 200
53
+ },
54
+ "search_results": [
55
+ {
56
+ "id": 9999,
57
+ "title": "",
58
+ "text": "Some String goes here",
59
+ "url": "http://example.com/user/statuses/9999999999",
60
+ "media_id": 2412312312,
61
+ "published_on": "2014-11-07T18:40:54.000-02:00",
62
+ "user": "user",
63
+ "user_id": null,
64
+ "user_image": "https://cdn.exampl.com/profile_images/9999999999/image.png",
65
+ "attached_image_url": null,
66
+ "social_media": "twitter",
67
+ "search_term": "\"term\"",
68
+ "polarization": 0,
69
+ "reach": 15794,
70
+ "favorite": false,
71
+ "latitude": null,
72
+ "longitude": null,
73
+ "country": null,
74
+ "country_short": null,
75
+ "state": null,
76
+ "state_short": null,
77
+ "city": null,
78
+ "gender": null
79
+ },
80
+ {
81
+ "id": 9999,
82
+ "title": "",
83
+ "text": "Some String goes here",
84
+ "url": "http://example.com/user/statuses/9999999999",
85
+ "media_id": 2412312312,
86
+ "published_on": "2014-11-07T18:40:54.000-02:00",
87
+ "user": "user",
88
+ "user_id": null,
89
+ "user_image": "https://cdn.exampl.com/profile_images/9999999999/image.png",
90
+ "attached_image_url": null,
91
+ "social_media": "twitter",
92
+ "search_term": "\"term\"",
93
+ "polarization": 0,
94
+ "reach": 15794,
95
+ "favorite": false,
96
+ "latitude": null,
97
+ "longitude": null,
98
+ "country": null,
99
+ "country_short": null,
100
+ "state": null,
101
+ "state_short": null,
102
+ "city": null,
103
+ "gender": null
104
+ }
105
+ ],
106
+ "tags": 1,
107
+ "medias": 4,
108
+ "active": true,
109
+ "sentiment_analysis": true
110
+ }
111
+ ```
112
+
37
113
 
38
114
  ### Searching for monitors
39
115
 
@@ -1,10 +1,38 @@
1
+ require 'pry'
1
2
  module Seekr
2
3
  class Occurrence
3
4
  include Seekr::Client
4
5
 
5
- def find_for(monitor_id, options = {})
6
- params = { search_id: monitor_id, per_page: 100 }.merge(options)
7
- get("/search_results", params)
6
+ PER_PAGE = 100
7
+
8
+ def initialize(monitor_id)
9
+ @monitor_id = monitor_id
10
+ end
11
+
12
+ def all_paginated(options={})
13
+ options[:page] = 1
14
+ response = get_search_results_json(options)
15
+ iterate = !(response['search_results'].size < PER_PAGE)
16
+ while iterate do
17
+ options[:page] += 1
18
+ next_page_response = get_search_results_json(options)['search_results']
19
+ break if next_page_response.size.zero?
20
+ response['search_results'].concat(next_page_response)
21
+ iterate = !(next_page_response.empty? || next_page_response.size < PER_PAGE)
22
+ end
23
+ JSON.dump(response)
24
+ end
25
+
26
+ private
27
+ def params
28
+ {
29
+ search_id: @monitor_id,
30
+ per_page: PER_PAGE
31
+ }
32
+ end
33
+
34
+ def get_search_results_json(options={})
35
+ JSON.parse(get("/search_results", params.merge(options)))
8
36
  end
9
37
  end
10
38
  end
@@ -1,3 +1,3 @@
1
1
  module Seekr
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seekr-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Pinto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.10.1
117
+ version: 0.10.3
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.10.1
124
+ version: 0.10.3
125
125
  description: Ruby client for Seekr Monitor API.
126
126
  email:
127
127
  - rodrigopqn@gmail.com
@@ -135,7 +135,6 @@ files:
135
135
  - ".travis.yml"
136
136
  - Gemfile
137
137
  - LICENSE
138
- - LICENSE.txt
139
138
  - README.md
140
139
  - Rakefile
141
140
  - lib/seekr.rb
@@ -166,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
165
  version: '0'
167
166
  requirements: []
168
167
  rubyforge_project:
169
- rubygems_version: 2.4.2
168
+ rubygems_version: 2.4.8
170
169
  signing_key:
171
170
  specification_version: 4
172
171
  summary: Ruby client for Seekr Monitor API.
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Rodrigo Pinto
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.