Sha256: dadd46c7570951e23898b9321b9adfb178c1bd3084dc2b144e5ff8efae0152d3

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

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 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

1 entries across 1 versions & 1 rubygems

Version Path
givey_ruby-0.0.1 lib/givey_ruby/model.rb