Class: Fitting::Records::Spherical::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/fitting/records/spherical/request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, path:, body:, response:, title:, group:, host:) ⇒ Request

Returns a new instance of Request.



10
11
12
13
14
15
16
17
18
# File 'lib/fitting/records/spherical/request.rb', line 10

def initialize(method:, path:, body:, response:, title:, group:, host:)
  @method = method
  @path = path
  @body = body
  @response = response
  @title = title
  @group = group
  @host = host
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def body
  @body
end

#groupObject (readonly)

Returns the value of attribute group.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def group
  @group
end

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def host
  @host
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def path
  @path
end

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def response
  @response
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/fitting/records/spherical/request.rb', line 8

def title
  @title
end

Class Method Details

.load(hash) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fitting/records/spherical/request.rb', line 37

def load(hash)
  new(
    method: hash['method'],
    path: hash['path'],
    body: hash['body'],
    response: Fitting::Records::Spherical::Response.load(hash['response']),
    title: hash['title'],
    group: hash['group'],
    host: hash['host']
  )
end

Instance Method Details

#to_hashObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fitting/records/spherical/request.rb', line 20

def to_hash
  {
    method: method,
    path: path.to_s,
    body: body,
    response: response.to_hash,
    title: title,
    group: group,
    host: host
  }
end

#to_json(*_args) ⇒ Object



32
33
34
# File 'lib/fitting/records/spherical/request.rb', line 32

def to_json(*_args)
  JSON.dump(to_hash)
end