Class: MixpanelExport::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/mixpanel_export/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_secret, api_key) ⇒ Request

Returns a new instance of Request.



14
15
16
17
# File 'lib/mixpanel_export/request.rb', line 14

def initialize(api_secret, api_key)
  @api_secret = api_secret
  @api_key = api_key
end

Instance Method Details

#get(path, options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/mixpanel_export/request.rb', line 19

def get(path, options={})
  response = self.class.get(path, query: build_query(Hash[normalize(options)]))

  if response.success?
    response.parsed_response || ""
  else
    raise RequestError, response.parsed_response["error"]
  end
end