Class: GiveyRuby::Configuration
- Inherits:
-
Object
- Object
- GiveyRuby::Configuration
- Defined in:
- lib/givey_ruby/configuration.rb
Instance Method Summary collapse
- #api_site ⇒ Object
- #api_version(version = "v1") ⇒ Object
- #client(client_options = {}) ⇒ Object
- #token_file ⇒ Object
- #token_file=(file_path) ⇒ Object
Instance Method Details
#api_site ⇒ Object
24 25 26 |
# File 'lib/givey_ruby/configuration.rb', line 24 def api_site @api_site end |
#api_version(version = "v1") ⇒ Object
20 21 22 |
# File 'lib/givey_ruby/configuration.rb', line 20 def api_version(version = "v1") @api_version ||= version end |
#client(client_options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/givey_ruby/configuration.rb', line 5 def client( = {}) @client ||= begin # TODO: ensure consumer key and secret @api_site = .include?(:api_site) ? [:api_site] : "http://api.givey.com" opts = {:site => @api_site, :authorize_url => "/#{api_version}/oauth/authorize", :token_url => "/#{api_version}/oauth/token", :raise_errors => false} @token_file = .include?(:token_file) ? [:token_file] : "../tmp/givey_token_file" OAuth2::Client.new([:consumer_key], [:consumer_secret], opts) do |builder| # POST/PUT params encoders: builder.request :multipart builder.request :url_encoded builder.adapter :net_http end end end |
#token_file ⇒ Object
28 29 30 |
# File 'lib/givey_ruby/configuration.rb', line 28 def token_file @token_file end |
#token_file=(file_path) ⇒ Object
32 33 34 |
# File 'lib/givey_ruby/configuration.rb', line 32 def token_file=(file_path) @token_file = file_path end |