Class: LsaTdxFeedback::TicketClient
- Inherits:
-
Object
- Object
- LsaTdxFeedback::TicketClient
- Includes:
- HTTParty
- Defined in:
- lib/lsa_tdx_feedback/ticket_client.rb
Instance Method Summary collapse
- #create_feedback_ticket(feedback_data) ⇒ Object
-
#initialize(configuration = LsaTdxFeedback.configuration) ⇒ TicketClient
constructor
A new instance of TicketClient.
Constructor Details
#initialize(configuration = LsaTdxFeedback.configuration) ⇒ TicketClient
Returns a new instance of TicketClient.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lsa_tdx_feedback/ticket_client.rb', line 7 def initialize(configuration = LsaTdxFeedback.configuration) @configuration = configuration @configuration.validate! @oauth_client = OAuthClient.new(configuration) self.class.base_uri(@configuration.api_base_url) self.class.headers({ 'Content-Type' => 'application/json', 'Accept' => 'application/json' }) end |
Instance Method Details
#create_feedback_ticket(feedback_data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/lsa_tdx_feedback/ticket_client.rb', line 19 def create_feedback_ticket(feedback_data) ticket_payload = build_ticket_payload(feedback_data) response = self.class.post("/#{@configuration.app_id}/tickets", headers: { 'Authorization' => "Bearer #{@oauth_client.get_access_token}" }, body: ticket_payload.to_json ) if response.success? response.parsed_response else handle_error_response(response) end end |