Module: LazyAnt::DSL::Connection
- Extended by:
- ActiveSupport::Concern
- Included in:
- LazyAnt::DSL, Endpoint
- Defined in:
- lib/lazy_ant/dsl/connection.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#default_params ⇒ Object
readonly
Returns the value of attribute default_params.
Instance Method Summary collapse
- #connection ⇒ Object
- #converter_block ⇒ Object
- #converter_name ⇒ Object
- #default_callback ⇒ Object
- #request_type ⇒ Object
- #response_type ⇒ Object
- #use_converter(con) ⇒ Object
Instance Attribute Details
#default_params ⇒ Object (readonly)
Returns the value of attribute default_params.
8 9 10 |
# File 'lib/lazy_ant/dsl/connection.rb', line 8 def default_params @default_params end |
Instance Method Details
#connection ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lazy_ant/dsl/connection.rb', line 10 def connection return @connection if @connection @connection = Faraday.new(base_url) do |con| con.request request_type use_converter(con) con.response response_type con.response :raise_error con.adapter Faraday.default_adapter instance_exec(con, &default_callback) if default_callback end end |
#converter_block ⇒ Object
36 37 38 39 40 |
# File 'lib/lazy_ant/dsl/connection.rb', line 36 def converter_block @converter_block ||= self.class.instance_variable_get(:@converter_block) || @parent && @parent.converter_block end |
#converter_name ⇒ Object
42 43 44 45 46 |
# File 'lib/lazy_ant/dsl/connection.rb', line 42 def converter_name @coverter_name ||= self.class.instance_variable_get(:@converter_name) || @parent && @parent.converter_name end |
#default_callback ⇒ Object
30 31 32 33 34 |
# File 'lib/lazy_ant/dsl/connection.rb', line 30 def default_callback @default_callback ||= self.class.instance_variable_get(:@default_callback) || @parent && @parent.default_callback end |
#request_type ⇒ Object
48 49 50 51 52 |
# File 'lib/lazy_ant/dsl/connection.rb', line 48 def request_type @request_type ||= self.class.instance_variable_get(:@request_type) || @parent && @parent.request_type || :json end |
#response_type ⇒ Object
54 55 56 57 58 |
# File 'lib/lazy_ant/dsl/connection.rb', line 54 def response_type @response_type ||= self.class.instance_variable_get(:@response_type) || @parent && @parent.response_type || :json end |