class Kintone::Client
Constants
- ENDPOINT
- VERSION
Public Class Methods
new(options) { |faraday| ... }
click to toggle source
# File lib/kintone/client/client.rb, line 4 def initialize(options) @auth = {} if options[:api_token] @auth[:api_token] = options.delete(:api_token) else [:login_name, :password].each do |k| @auth[k] = options.fetch(k) options.delete(k) end end unless options[:url] options[:url] = ENDPOINT % options.fetch(:subdomain) options.delete(:subdomain) end @conn = Faraday.new(options) do |faraday| faraday.request :url_encoded faraday.request :record, :content_type => /\bjson\b/ faraday.response :form, :content_type => /\bjson\b/ # must set before :json faraday.response :json, :content_type => /\bjson\b/ yield(faraday) if block_given? required_adapters = [Faraday::Adapter::NetHttp, Faraday::Adapter::Test] unless required_adapters.any? {|i| faraday.builder.handlers.include?(i) } faraday.adapter Faraday.default_adapter end end end
Private Instance Methods
method_missing(method_name, *args)
click to toggle source
# File lib/kintone/client/client.rb, line 39 def method_missing(method_name, *args) unless args.length.zero? raise ArgumentError, "wrong number of arguments (#{args.length} for 0)" end Path.new(@conn, @auth, method_name.to_s) end