Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed dependence on environment variables by allowing variables to be set on instantiation #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
instagram_basic_display (0.2.0)
instagram_basic_display (0.3.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -59,7 +59,7 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.16)
bundler
dotenv
instagram_basic_display!
pry
Expand Down
2 changes: 1 addition & 1 deletion instagram_basic_display.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
end
7 changes: 4 additions & 3 deletions lib/instagram_basic_display/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class Client
# authentication utilities provided.
#
# @return void
def initialize(auth_token: nil)
@auth_token = auth_token
def initialize(opts = {})
@auth_token = opts[:auth_token]
@opts = opts

@auth = Auth.new(configuration)
@profile = Profile.new(configuration)
Expand All @@ -49,7 +50,7 @@ def initialize(auth_token: nil)
#
# @return [InstagramBasicDisplay::Configuration]
def configuration
@configuration ||= InstagramBasicDisplay::Configuration.new(auth_token: @auth_token)
@configuration ||= InstagramBasicDisplay::Configuration.new(@opts)
end

# Sets the gem's configuration
Expand Down
10 changes: 5 additions & 5 deletions lib/instagram_basic_display/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class Configuration
# @param auth_token [String] token that will be used to make requests
#
# @return void
def initialize(auth_token: nil)
@client_id = set_client_id
@client_secret = set_client_secret
@redirect_uri = set_redirect_uri
@auth_token = auth_token
def initialize(opts = {})
@auth_token = opts[:auth_token]
@client_id = opts[:client_id] || set_client_id
@client_secret = opts[:client_secret] || set_client_secret
@redirect_uri = opts[:redirect_uri] || set_redirect_uri
end

def set_client_id
Expand Down
2 changes: 1 addition & 1 deletion lib/instagram_basic_display/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
# limitations under the License.

module InstagramBasicDisplay
VERSION = '0.2.0'
VERSION = '0.3.1'
end