Class: Microsoft::Graph::Batch::Request
- Inherits:
-
Object
- Object
- Microsoft::Graph::Batch::Request
- Defined in:
- lib/microsoft/graph/batch.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#depends_on ⇒ Object
Returns the value of attribute depends_on.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(endpoint, id:, method:, headers:, params:, body:, depends_on:) ⇒ Request
constructor
A new instance of Request.
- #to_h ⇒ Object
Constructor Details
#initialize(endpoint, id:, method:, headers:, params:, body:, depends_on:) ⇒ Request
Returns a new instance of Request.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/microsoft/graph/batch.rb', line 51 def initialize(endpoint, id:, method:, headers:, params:, body:, depends_on:) @id = id @endpoint = "#{self.class.parser.escape(endpoint)}#{params ? "?#{params.to_query}" : ""}" @method = method.upcase @headers = headers @headers[:Accept] = "application/json" if body @headers[:"Content-Type"] = "application/json" if body @body = body @depends_on = depends_on end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
48 49 50 |
# File 'lib/microsoft/graph/batch.rb', line 48 def body @body end |
#depends_on ⇒ Object
Returns the value of attribute depends_on.
49 50 51 |
# File 'lib/microsoft/graph/batch.rb', line 49 def depends_on @depends_on end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
48 49 50 |
# File 'lib/microsoft/graph/batch.rb', line 48 def endpoint @endpoint end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
48 49 50 |
# File 'lib/microsoft/graph/batch.rb', line 48 def headers @headers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
48 49 50 |
# File 'lib/microsoft/graph/batch.rb', line 48 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
48 49 50 |
# File 'lib/microsoft/graph/batch.rb', line 48 def method @method end |
Class Method Details
.body_formatter ⇒ Object
44 45 46 |
# File 'lib/microsoft/graph/batch.rb', line 44 def self.body_formatter @body_formatter ||= Microsoft::Graph::BodyFormatter.new end |
.parser ⇒ Object
40 41 42 |
# File 'lib/microsoft/graph/batch.rb', line 40 def self.parser @parser ||= URI::Parser.new end |
Instance Method Details
#to_h ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/microsoft/graph/batch.rb', line 62 def to_h hash = { id: @id, url: @endpoint, method: @method } hash[:headers] = @headers unless @headers.empty? hash[:body] = self.class.body_formatter.call(@body, method: @method) if @body hash[:dependsOn] = [@depends_on] if @depends_on hash end |