Sha256: 6c9dcc2651ed2ab86cd157896798e14449d4a1ccd886df1a1ee6e0d424f729ee
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
class Restly::Client < OAuth2::Client attr_accessor :id, :secret, :site attr_reader :format def initialize(*args, &block) opts = args.extract_options! self.id = args[0] || Restly::Configuration.oauth_options[:client_id] self.secret = args[1] || Restly::Configuration.oauth_options[:client_secret] self.site = opts.delete(:site) || Restly::Configuration.site self.options = Restly::Configuration.client_options.merge(opts) self.ssl = opts.delete(:ssl) || Restly::Configuration.ssl self.format = @format = opts.delete(:format) || Restly::Configuration.default_format self.options[:connection_build] = block end def ssl=(val) self.options[:connection_opts][:ssl] = val if val end def format=(val) self.options[:connection_opts][:headers] = { "Accept" => "application/#{format}", "Content-Type" => "application/#{format}" } end Restly::Configuration.client_options.keys.each do |m| define_method "#{m}=" do |val| self.options[m] = val end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
restly-0.0.1.alpha.6 | lib/restly/client.rb |
restly-0.0.1.alpha.4 | lib/restly/client.rb |
restly-0.0.1.alpha.3 | lib/restly/client.rb |
restly-0.0.1.alpha.2 | lib/restly/client.rb |