Class: GiveyRuby::Configuration
- Inherits:
-
Object
- Object
- GiveyRuby::Configuration
- Defined in:
- lib/givey_ruby/configuration.rb
Instance Method Summary collapse
- #api_site ⇒ Object
- #api_version ⇒ Object
- #client(client_options = {}) ⇒ Object
- #token_file ⇒ Object
- #token_file=(file_path) ⇒ Object
Instance Method Details
#api_site ⇒ Object
25 26 27 |
# File 'lib/givey_ruby/configuration.rb', line 25 def api_site @api_site end |
#api_version ⇒ Object
21 22 23 |
# File 'lib/givey_ruby/configuration.rb', line 21 def api_version @api_version end |
#client(client_options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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" @api_version = .include?(:api_version) ? [:api_version] : "v2" 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
29 30 31 |
# File 'lib/givey_ruby/configuration.rb', line 29 def token_file @token_file end |
#token_file=(file_path) ⇒ Object
33 34 35 |
# File 'lib/givey_ruby/configuration.rb', line 33 def token_file=(file_path) @token_file = file_path end |