Class: OMCMS::Client
- Inherits:
-
Object
- Object
- OMCMS::Client
- Defined in:
- lib/omcms/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #configure_client ⇒ Object
-
#initialize(opts) ⇒ Client
constructor
A new instance of Client.
- #offerings ⇒ Object
Constructor Details
#initialize(opts) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/omcms/client.rb', line 7 def initialize(opts) configure_credentials(opts) @client = configure_client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/omcms/client.rb', line 5 def client @client end |
Instance Method Details
#configure_client ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/omcms/client.rb', line 12 def configure_client @configure_client ||= Faraday.new do |f| f.request :authorization, :basic, @username, @password f.[:open_timeout] = @open_timeout f.[:timeout] = @timeout f.request :omcms_set_header f.response :omcms_parse_response f.response :json, content_type: /\bjson$/ f.adapter :httpclient end end |