espresso_path 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/espresso_path.rb +0 -1
- data/lib/espresso_path/client.rb +96 -8
- data/lib/espresso_path/version.rb +1 -1
- metadata +2 -3
- data/lib/espresso_path/geo_path.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 782ffeb775af8ac72603913761b9d673a7014a61
|
4
|
+
data.tar.gz: 4fc4b1160addf1818b99c13d01f79c60e805338e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1940e193579f38dd7776d7ffa1f23cbf0275e526fef45e5f60474f14d5b8c2cab1270043393e0632154c879eb4375fe6236f58096b0a7bf8c049b6b146d799d1
|
7
|
+
data.tar.gz: ceba57d5a3da89bfc220f1e5b433800cf187d531f69b6ca147dad75e4bdbc9956681ba474afc0cfd1a4e4c3aacea68851631b7d5e3c5f9218c7853ea3627fc17
|
data/README.md
CHANGED
data/lib/espresso_path.rb
CHANGED
data/lib/espresso_path/client.rb
CHANGED
@@ -26,25 +26,62 @@ module EspressoPath
|
|
26
26
|
@options = {
|
27
27
|
headers: {
|
28
28
|
Authorization: "Bearer #{@access_token}"
|
29
|
-
}
|
30
|
-
|
29
|
+
}
|
31
30
|
}
|
32
31
|
end
|
33
32
|
|
34
33
|
def map_services(type, level, ids, options = @options)
|
35
|
-
options[:query] = { ids: ids}
|
36
|
-
puts options.inspect
|
34
|
+
options[:query] = { ids: ids }
|
37
35
|
self.class.get("/mapservices/#{type}/#{level}", @options)
|
38
36
|
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
# Get Audience
|
39
|
+
#
|
40
|
+
# # ==== Attributes
|
41
|
+
# * +daypart_ids+ - REQUIRED - Comma-separated list of daypart IDs.
|
42
|
+
# * +demo_ids+ - Optional - Comma-separated list of demo IDs. Either this or custom_demo_ids must be provided.
|
43
|
+
# * +custom_demo_ids+ - Optional - Comma-separated list of custom demo IDs. Either this or demo_ids must be provided.
|
44
|
+
# * +panel_ids+ - REQUIRED - Comma-separated list of panel IDs.
|
45
|
+
# * +market_id+ - REQUIRED - Market ID to get information for.
|
46
|
+
# * +population_base+ - REQUIRED - Base population.
|
47
|
+
def audience(daypart_ids, panel_ids, market_id, population_base, opts ={})
|
48
|
+
options = @options
|
49
|
+
options[:query] = { daypart_ids: daypart_ids, panel_ids: panel_ids, market_id: market_id,
|
50
|
+
population_base: population_base }.merge(opts)
|
51
|
+
self.class.get('/audience', options)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get Home Audience
|
55
|
+
#
|
56
|
+
# # ==== Attributes
|
57
|
+
# * +daypart_id+ - REQUIRED - Daypart ID to look for.
|
58
|
+
# * +demo_id+ - Optional - Comma-separated list of demo IDs. Either this or custom_demo_ids must be provided.
|
59
|
+
# * +custom_demo_id+ - Optional - Comma-separated list of custom demo IDs. Either this or demo_ids must be provided.
|
60
|
+
# * +panel_ids+ - REQUIRED - Comma-separated list of panel IDs.
|
61
|
+
# * +market_id+ - REQUIRED - Market ID to get information for.
|
62
|
+
# * +population_base+ - REQUIRED - Base population.
|
63
|
+
# * +reporting_level+ - REQUIRED - Geo level to get homes for.
|
64
|
+
def audience_home(daypart_id, panel_ids, market_id, population_base, reporting_level, opts ={})
|
65
|
+
options = @options
|
66
|
+
options[:query] = { daypart_id: daypart_id, panel_ids: panel_ids,
|
67
|
+
market_id: market_id, reporting_level: reporting_level,
|
68
|
+
population_base: population_base }.merge(opts)
|
69
|
+
self.class.get('/audience/homes', options)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Gets all Census Tracts
|
44
73
|
def census_tracts
|
45
74
|
self.class.get('/census-tracts', @options)
|
46
75
|
end
|
47
76
|
|
77
|
+
# Gets specified Census Tract
|
78
|
+
# # ==== Attributes
|
79
|
+
#
|
80
|
+
# * +id+ - Required - Census TractID
|
81
|
+
def census_tract(id)
|
82
|
+
self.class.get("/census-tracts/#{id}", @options)
|
83
|
+
end
|
84
|
+
|
48
85
|
def counties
|
49
86
|
self.class.get('/counties', @options)
|
50
87
|
end
|
@@ -53,6 +90,55 @@ module EspressoPath
|
|
53
90
|
self.class.get('/custom-demos', @options)
|
54
91
|
end
|
55
92
|
|
93
|
+
def custom_demo(id)
|
94
|
+
self.class.get("/custom-demos/#{id}", @options)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Create a Custom Demographic
|
98
|
+
# # ==== Attributes
|
99
|
+
#
|
100
|
+
# * +name+ - Required - The name of demographic
|
101
|
+
# * +age_min+ - Optional - The minimum age in the custom demo
|
102
|
+
# * +age_max+ - Optional - The maximum age in the custom demo
|
103
|
+
# * +hhinc_min+ - Optional - The minimum household income in the custom demo
|
104
|
+
# * +hhinc_max+ - Optional - The maximum household income in the custom demo
|
105
|
+
# * +races+ - Optional - The races included in the custom demo. Supported values are white, black, amerindian, asian, pacific, other
|
106
|
+
# * +sex+ - Optional - The sex in the custom demo
|
107
|
+
# * +employed+ - Optional - The employment status in the custom demo
|
108
|
+
# * +audience+ - Required - Who can use this custom demo
|
109
|
+
def create_custom_demo(name, audience = 'company', opts = {})
|
110
|
+
options = @options
|
111
|
+
options[:query] = { name: name, audience: audience }.merge(opts)
|
112
|
+
self.class.post('/custom-demos', options)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Update a Custom Demographic
|
116
|
+
# # ==== Attributes
|
117
|
+
#
|
118
|
+
# * +id+ - Required - Custom Demographic ID
|
119
|
+
# * +name+ - Optional - The name of demographic
|
120
|
+
# * +age_min+ - Optional - The minimum age in the custom demo
|
121
|
+
# * +age_max+ - Optional - The maximum age in the custom demo
|
122
|
+
# * +hhinc_min+ - Optional - The minimum household income in the custom demo
|
123
|
+
# * +hhinc_max+ - Optional - The maximum household income in the custom demo
|
124
|
+
# * +races+ - Optional - The races included in the custom demo. Supported values are white, black, amerindian, asian, pacific, other
|
125
|
+
# * +sex+ - Optional - The sex in the custom demo
|
126
|
+
# * +employed+ - Optional - The employment status in the custom demo
|
127
|
+
# * +audience+ - Optional - Who can use this custom demo
|
128
|
+
def update_custom_demo(id, opts = {})
|
129
|
+
options = @options
|
130
|
+
options[:query] = opts
|
131
|
+
self.class.put("/custom-demos/#{id}", options)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Delete a Custom Demographic
|
135
|
+
# # ==== Attributes
|
136
|
+
#
|
137
|
+
# * +id+ - Required - Custom Demographic ID
|
138
|
+
def delete_custom_demo(id)
|
139
|
+
self.class.delete("/custom-demos/#{id}", @options)
|
140
|
+
end
|
141
|
+
|
56
142
|
def custom_markets
|
57
143
|
self.class.get('/custom-markets', @options)
|
58
144
|
end
|
@@ -126,5 +212,7 @@ module EspressoPath
|
|
126
212
|
def states
|
127
213
|
self.class.get('/states', @options)
|
128
214
|
end
|
215
|
+
|
216
|
+
|
129
217
|
end
|
130
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: espresso_path
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KickinEspresso
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -141,7 +141,6 @@ files:
|
|
141
141
|
- lib/espresso_path.rb
|
142
142
|
- lib/espresso_path/client.rb
|
143
143
|
- lib/espresso_path/configuration.rb
|
144
|
-
- lib/espresso_path/geo_path.rb
|
145
144
|
- lib/espresso_path/models/market.rb
|
146
145
|
- lib/espresso_path/version.rb
|
147
146
|
- lib/generators/espresso_path/install_generator.rb
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'httparty'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module EspressoPath
|
6
|
-
class GeoPath
|
7
|
-
include HTTParty
|
8
|
-
#base_uri 'insights-api.geopath.org'
|
9
|
-
|
10
|
-
def login
|
11
|
-
self.class.base_uri EspressoPath.configuration.base_url
|
12
|
-
uri = URI.parse(EspressoPath.configuration.base_url + "/login")
|
13
|
-
|
14
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
15
|
-
http.use_ssl = true
|
16
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
17
|
-
request = Net::HTTP::Post.new(uri.request_uri)
|
18
|
-
request.set_form_data({ :username => EspressoPath.configuration.user_name, :password => EspressoPath.configuration.password })
|
19
|
-
|
20
|
-
response = http.request(request)
|
21
|
-
body = JSON.parse(response.body)
|
22
|
-
|
23
|
-
@access_token = body["access_token"]
|
24
|
-
|
25
|
-
@options = {
|
26
|
-
headers: {
|
27
|
-
"Authorization"=> "Bearer #{@access_token}"
|
28
|
-
}
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
def audience
|
33
|
-
self.class.get("/audience", @options)
|
34
|
-
end
|
35
|
-
|
36
|
-
def day_parts
|
37
|
-
self.class.get("/day-parts", @options)
|
38
|
-
end
|
39
|
-
|
40
|
-
def counties
|
41
|
-
self.class.get("/counties", @options)
|
42
|
-
end
|
43
|
-
|
44
|
-
def custom_demos
|
45
|
-
self.class.get("/custom-demos", @options)
|
46
|
-
end
|
47
|
-
|
48
|
-
def media_types
|
49
|
-
self.class.get("/media-types", @options)
|
50
|
-
end
|
51
|
-
|
52
|
-
def operators
|
53
|
-
self.class.get("/operators", @options)
|
54
|
-
end
|
55
|
-
|
56
|
-
def plants
|
57
|
-
self.class.get("/plants", @options)
|
58
|
-
end
|
59
|
-
|
60
|
-
def markets
|
61
|
-
self.class.get("/markets", @options)
|
62
|
-
end
|
63
|
-
|
64
|
-
def market(market)
|
65
|
-
self.class.get("/markets/#{market}", @options)
|
66
|
-
end
|
67
|
-
|
68
|
-
def panels
|
69
|
-
self.class.get("/panels", @options)
|
70
|
-
end
|
71
|
-
|
72
|
-
def demo_categories
|
73
|
-
self.class.get("/demos/categories", @options)
|
74
|
-
end
|
75
|
-
|
76
|
-
def states
|
77
|
-
self.class.get("/states", @options)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|