Class: EspressoPath::GeoPath
- Inherits:
-
Object
- Object
- EspressoPath::GeoPath
- Includes:
- HTTParty
- Defined in:
- lib/espresso_path/geo_path.rb
Instance Method Summary collapse
- #audience ⇒ Object
- #counties ⇒ Object
- #custom_demos ⇒ Object
- #day_parts ⇒ Object
- #demo_categories ⇒ Object
-
#login ⇒ Object
base_uri ‘insights-api.geopath.org’.
- #market(market) ⇒ Object
- #markets ⇒ Object
- #media_types ⇒ Object
- #operators ⇒ Object
- #panels ⇒ Object
- #plants ⇒ Object
- #states ⇒ Object
Instance Method Details
#audience ⇒ Object
32 33 34 |
# File 'lib/espresso_path/geo_path.rb', line 32 def audience self.class.get("/audience", ) end |
#counties ⇒ Object
40 41 42 |
# File 'lib/espresso_path/geo_path.rb', line 40 def counties self.class.get("/counties", ) end |
#custom_demos ⇒ Object
44 45 46 |
# File 'lib/espresso_path/geo_path.rb', line 44 def custom_demos self.class.get("/custom-demos", ) end |
#day_parts ⇒ Object
36 37 38 |
# File 'lib/espresso_path/geo_path.rb', line 36 def day_parts self.class.get("/day-parts", ) end |
#demo_categories ⇒ Object
72 73 74 |
# File 'lib/espresso_path/geo_path.rb', line 72 def demo_categories self.class.get("/demos/categories", ) end |
#login ⇒ Object
base_uri ‘insights-api.geopath.org’
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/espresso_path/geo_path.rb', line 10 def login self.class.base_uri EspressoPath.configuration.base_url uri = URI.parse(EspressoPath.configuration.base_url + "/login") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({ :username => EspressoPath.configuration.user_name, :password => EspressoPath.configuration.password }) response = http.request(request) body = JSON.parse(response.body) @access_token = body["access_token"] = { headers: { "Authorization"=> "Bearer #{@access_token}" } } end |
#market(market) ⇒ Object
64 65 66 |
# File 'lib/espresso_path/geo_path.rb', line 64 def market(market) self.class.get("/markets/#{market}", ) end |
#markets ⇒ Object
60 61 62 |
# File 'lib/espresso_path/geo_path.rb', line 60 def markets self.class.get("/markets", ) end |
#media_types ⇒ Object
48 49 50 |
# File 'lib/espresso_path/geo_path.rb', line 48 def media_types self.class.get("/media-types", ) end |
#operators ⇒ Object
52 53 54 |
# File 'lib/espresso_path/geo_path.rb', line 52 def operators self.class.get("/operators", ) end |
#panels ⇒ Object
68 69 70 |
# File 'lib/espresso_path/geo_path.rb', line 68 def panels self.class.get("/panels", ) end |
#plants ⇒ Object
56 57 58 |
# File 'lib/espresso_path/geo_path.rb', line 56 def plants self.class.get("/plants", ) end |
#states ⇒ Object
76 77 78 |
# File 'lib/espresso_path/geo_path.rb', line 76 def states self.class.get("/states", ) end |