Class: XRPC::Endpoint
- Inherits:
-
Object
- Object
- XRPC::Endpoint
- Defined in:
- lib/bskyrb/xrpc.rb
Instance Attribute Summary collapse
-
#request_uri ⇒ Object
readonly
Returns the value of attribute request_uri.
Instance Method Summary collapse
- #get(params) ⇒ Object
-
#initialize(pds, endpoint_location, *params) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(pds, endpoint_location, *params) ⇒ Endpoint
Returns a new instance of Endpoint.
10 11 12 13 14 |
# File 'lib/bskyrb/xrpc.rb', line 10 def initialize(pds, endpoint_location, *params) @pds = pds @endpoint_location = endpoint_location @params = params end |
Instance Attribute Details
#request_uri ⇒ Object (readonly)
Returns the value of attribute request_uri.
8 9 10 |
# File 'lib/bskyrb/xrpc.rb', line 8 def request_uri @request_uri end |
Instance Method Details
#get(params) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/bskyrb/xrpc.rb', line 16 def get(params) query_params = URI.encode_www_form(params) @request_uri = URI("#{@pds}/xrpc/#{@endpoint_location}?#{query_params}") response = HTTParty.get(@request_uri) JSON.parse(response.body) end |