Class: DocusignDtr::Room
- Inherits:
-
Object
- Object
- DocusignDtr::Room
- Defined in:
- lib/docusign_dtr/room.rb
Constant Summary collapse
- MAX_ROOMS =
100
- MAX_BATCHES =
10_000
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #batch(options = {}) ⇒ Object
- #create(attrs = {}) ⇒ Object
- #destroy(id) ⇒ Object
- #find(id) ⇒ Object
-
#initialize(client:) ⇒ Room
constructor
A new instance of Room.
- #query_params(options) ⇒ Object
- #update(attrs = {}) ⇒ Object
Constructor Details
#initialize(client:) ⇒ Room
Returns a new instance of Room.
8 9 10 |
# File 'lib/docusign_dtr/room.rb', line 8 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/docusign_dtr/room.rb', line 3 def client @client end |
Instance Method Details
#all(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/docusign_dtr/room.rb', line 12 def all( = {}) [:count] ||= MAX_ROOMS rooms = [] (1..MAX_BATCHES).each do current_batch = batch() rooms += current_batch break if current_batch.size < [:count] end rooms end |
#batch(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/docusign_dtr/room.rb', line 23 def batch( = {}) @client.get('/rooms', query_params())['rooms'].map do |room_attrs| room = DocusignDtr::Models::Room.new(room_attrs) room.client = client room end rescue DocusignDtr::NoContent [] end |
#create(attrs = {}) ⇒ Object
44 |
# File 'lib/docusign_dtr/room.rb', line 44 def create(attrs = {}) end |
#destroy(id) ⇒ Object
46 |
# File 'lib/docusign_dtr/room.rb', line 46 def destroy(id) end |
#find(id) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/docusign_dtr/room.rb', line 37 def find(id) room_attrs = @client.get("/rooms/#{id}") room = DocusignDtr::Models::Room.new(room_attrs) room.client = client room end |
#query_params(options) ⇒ Object
33 34 35 |
# File 'lib/docusign_dtr/room.rb', line 33 def query_params() DocusignDtr::QueryParamHelper.call() end |
#update(attrs = {}) ⇒ Object
48 |
# File 'lib/docusign_dtr/room.rb', line 48 def update(attrs = {}) end |