Class: Smartsheet::API::EndpointSpec
- Inherits:
-
Object
- Object
- Smartsheet::API::EndpointSpec
- Defined in:
- lib/smartsheet/api/endpoint_spec.rb
Overview
Specification for a single endpoint's configuration
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
-
#url_segments ⇒ Object
readonly
Returns the value of attribute url_segments.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(method, url, **spec) ⇒ EndpointSpec
constructor
A new instance of EndpointSpec.
- #requires_auth? ⇒ Boolean
- #requires_body? ⇒ Boolean
- #sending_file? ⇒ Boolean
- #sending_json? ⇒ Boolean
Constructor Details
#initialize(method, url, **spec) ⇒ EndpointSpec
Returns a new instance of EndpointSpec.
27 28 29 30 31 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 27 def initialize(method, url, **spec) @method = method @url_segments = url @spec = spec end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 7 def method @method end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
7 8 9 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 7 def spec @spec end |
#url_segments ⇒ Object (readonly)
Returns the value of attribute url_segments.
7 8 9 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 7 def url_segments @url_segments end |
Instance Method Details
#headers ⇒ Object
49 50 51 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 49 def headers spec.key?(:headers) ? spec[:headers] : {} end |
#requires_auth? ⇒ Boolean
33 34 35 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 33 def requires_auth? !spec.key?(:no_auth) end |
#requires_body? ⇒ Boolean
37 38 39 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 37 def requires_body? spec.key? :body_type end |
#sending_file? ⇒ Boolean
41 42 43 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 41 def sending_file? requires_body? && spec[:body_type] == :file end |
#sending_json? ⇒ Boolean
45 46 47 |
# File 'lib/smartsheet/api/endpoint_spec.rb', line 45 def sending_json? requires_body? && spec[:body_type] == :json end |