-2

I'm sending a POST request in an API that returns a token, how do I assign a variable to this generated value?

1 Answers1

0

In Ruby, you assign a variable using the equal sign = binary infix assignment operator. See section 11.4.2.2.2 Single variable assignments of the ISO/IEC 30170:2012 Information technology — Programming languages — Ruby specification.

For example, to assign the result of sending the message bar to the local variable foo, you would write:

foo = bar
Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653