Method: Echochamber::Request.create_widget
- Defined in:
- lib/echochamber/widget/request.rb
.create_widget(token, widget) ⇒ Hash
Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to the client
8 9 10 11 12 13 14 15 |
# File 'lib/echochamber/widget/request.rb', line 8 def self.(token, ) endpoint = ENDPOINT.fetch(:widget) headers = { :content_type => :json, :accept => :json, 'Access-Token' => token} headers.merge!('X-User-Id' => .user_id) unless .user_id.nil? headers.merge!('X-User-Email' => .user_email) unless .user_email.nil? response = post(endpoint, , headers) JSON.parse(response.body) end |