class TijuanaClient::Client
Public Instance Methods
default_options()
click to toggle source
# File lib/tijuana_client/client.rb, line 15 def default_options { user_agent: 'TijuanaClient', prefix: '', content_type: 'application/x-www-form-urlencoded' } end
post_json_request(path, params)
click to toggle source
# File lib/tijuana_client/client.rb, line 9 def post_json_request(path, params) p = {} p['data'] = params.to_json post_request(path, p) end
setup()
click to toggle source
# File lib/tijuana_client/client.rb, line 42 def setup connection.stack do |builder| builder.use Faraday::Request::Multipart builder.use Faraday::Request::UrlEncoded if connection.configuration.authenticated? builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password end builder.use Faraday::Response::Logger if ENV['DEBUG'] builder.use TijuanaClient::ErrorMiddleware builder.adapter connection.configuration.adapter end end
user()
click to toggle source
# File lib/tijuana_client/client.rb, line 5 def user @user ||= TijuanaClient::User.new(client: self) end
Private Instance Methods
extract_data_from_params(params)
click to toggle source
# File lib/tijuana_client/client.rb, line 60 def extract_data_from_params(params) if params.key?('data') && params['data'].present? { 'data' => params['data'] } else params end end