Since yesterday I reviewed the RestClient::Response class, it’s time to read the parent class RestClient::AbstractResponse. There are a few interesting methods in AbstractResponse but the #return! method is a good one to review. The Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 …
Tag: apis
Daily Code Reading #24 – RestClient::Response
Yesterday I looked at the Request side of RestClient so I’m reading through the RestClient::Response class today. RestClient::Request#execute returns this response object from it’s #process_result. 1 response = Response.new(Request.decode(res['content-encoding'], res.body), res, args)response = Response.new(Request.decode(res['content-encoding'], res.body), res, args) The Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 …
Daily Code Reading #23 – RestClient::Request#execute
After looking at the other RestClient::Resource methods from yesterday, I noticed that they are all almost identical to #get. So today I’m going to dig into the code one level down, RestClient::Request. The Code RestClient::Request#execute 1 2 3 4 5 6 7 module RestClient class Request def self.execute(args, &block) new(args).execute &block end end endmodule RestClient …
Daily Code Reading #22 – RestClient::Resource#get
From yesterday’s code reading, I found that the restclient command uses RestClient::Resource for most of the work. So I’m going to start with it’s methods, starting with it’s HTTP verbs, #get. The Code 1 2 3 4 5 6 7 8 9 10 11 module RestClient class Resource def get(additional_headers={}, &block) headers = (options[:headers] || …
Daily Code Reading #21 – RestClient binary
This week I’m going to read through the code for RestClient. RestClient is a simple HTTP and REST client for Ruby that can be used to consume RESTful resources. I’ve used it in a Single Sign On system I built for Redmine, redmine_sso_client and redmine_sso_server. Today I started with the command line binary for RestClient. …