Class: Multicolor::REST::Transport
- Inherits:
-
Object
- Object
- Multicolor::REST::Transport
- Defined in:
- lib/multicolor/rest/transport.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Transport
constructor
A new instance of Transport.
Methods included from Endpoints::Metadata
#count, #count_collection_colors, #count_metadata, #get_return_metadata, #get_search_metadata, #list, #ping
Methods included from Endpoints::Indexing
Methods included from Endpoints::Filepath
#color_search, #extract_collection_colors, #get_metadata, #update_metadata
Constructor Details
#initialize(config) ⇒ Transport
Returns a new instance of Transport.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/multicolor/rest/transport.rb', line 16 def initialize(config) @config = config @client = Faraday.new(url: url) do |conn| conn.request :multipart conn.request :url_encoded conn.response :json conn.adapter :net_http conn.use Faraday::Response::RaiseError conn.[:timeout] = config.timeout conn.[:open_timeout] = config.open_timeout conn.basic_auth(config.username, config.password) if config.authenticate? end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
12 13 14 |
# File 'lib/multicolor/rest/transport.rb', line 12 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/multicolor/rest/transport.rb', line 12 def config @config end |