Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Add option to configure FaradayMiddleware::Mashify mash_class #213

Open
wants to merge 1 commit into
base: master
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
4 changes: 4 additions & 0 deletions lib/instagram/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Configuration
:no_response_wrapper,
:loud_logger,
:sign_requests,
:mash_class
].freeze

# By default, don't set a user access token
Expand Down Expand Up @@ -80,6 +81,8 @@ module Configuration
# By default, requests are not signed
DEFAULT_SIGN_REQUESTS = false

DEFAULT_MASH_CLASS = nil

# @private
attr_accessor *VALID_OPTIONS_KEYS

Expand Down Expand Up @@ -117,6 +120,7 @@ def reset
self.no_response_wrapper= DEFAULT_NO_RESPONSE_WRAPPER
self.loud_logger = DEFAULT_LOUD_LOGGER
self.sign_requests = DEFAULT_SIGN_REQUESTS
self.mash_class = DEFAULT_MASH_CLASS
end
end
end
1 change: 1 addition & 0 deletions lib/instagram/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def connection(raw=false)
Faraday::Connection.new(options) do |connection|
connection.use FaradayMiddleware::InstagramOAuth2, client_id, access_token
connection.use Faraday::Request::UrlEncoded
FaradayMiddleware::Mashify.mash_class = Instagram.mash_class
connection.use FaradayMiddleware::Mashify unless raw
unless raw
case format.to_s.downcase
Expand Down