Skip to content

Commit

Permalink
creates consumer now. also stores the consumer secret and token in se…
Browse files Browse the repository at this point in the history
…crets.yml refs #4
  • Loading branch information
walshbr committed Feb 8, 2017
1 parent 5a8b59f commit 6af417b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage/*
doc/*
log/*
pkg/*
lib/zotero/secrets.yml
17 changes: 17 additions & 0 deletions lib/zotero.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
require 'zotero/version'
require 'yaml'

gem 'oauth', '>= 0.5.1'
require 'oauth'



module Zotero
@default_site = 'https://api.zotero.org' # Version can be appended here, or passed in by the user

def self.secret
YAML.load_file(File.expand_path('zotero/secrets.yml', 'lib'))
end

def self.consumer_token
self.secret['consumer_token']
end
def self.consumer_secret
self.secret['consumer_secret']
end

# Will create an OAuth Consumer for you.
#
# You have to register your application on Zotero.org to get a consumer token and secret.
Expand All @@ -21,4 +35,7 @@ def self.consumer(consumer_token, consumer_secret, site = @default_site)
authorize_path: '/oauth/authorize'
)
end

def self.register()
end
end
5 changes: 3 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ def zotero_main_site
end

def zotero_settings
secret = YAML.load_file(File.expand_path('zotero/secrets.yml', 'lib'))
{
access_token: 'spec_test_access_token',
access_secret: 'spec_test_access_secret',
consumer_token: 'spec_test_key',
consumer_secret: 'spec_test_secret',
consumer_token: secret['consumer_token'],
consumer_secret: secret['consumer_secret'],
bad_consumer_token: 'bad_consumer_key',
bad_consumer_secret: 'bad_consumer_secret'
}
Expand Down

0 comments on commit 6af417b

Please sign in to comment.