Sha256: 23c25445ab8bf3e7a12c5137a0ce45711dad8a14834a0b4325e05faa26a22432
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
module GiveyRuby module Model module ClassMethods def setup_givey_sdk(options = {}) #options = default_model_options.merge(options) end end module InstanceMethods def access_token @access_token ||= begin if self.respond_to?(:givey_token) && self.givey_token api_token = OAuth2::AccessToken.new(api_client, self.givey_token) elsif ENV['GIVEY_TOKEN'] api_token = OAuth2::AccessToken.new(api_client, ENV['GIVEY_TOKEN']) elsif givey_token = token_from_file api_token = OAuth2::AccessToken.new(api_client, givey_token) else api_token = api_client.client_credentials.get_token token_to_file(api_token.token) end api_token end end end def self.included(receiver) receiver.extend GiveyRuby::Shared::ClassMethods receiver.send :include, GiveyRuby::Shared::InstanceMethods receiver.send :include, InstanceMethods receiver.send :setup_givey_sdk end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
givey_ruby-0.0.6 | lib/givey_ruby/model.rb |
givey_ruby-0.0.5 | lib/givey_ruby/model.rb |
givey_ruby-0.0.3 | lib/givey_ruby/model.rb |
givey_ruby-0.0.2 | lib/givey_ruby/model.rb |