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 22 23 24 |
# File 'lib/docusign_dtr/room.rb', line 12 def all( = {}) [:count] ||= MAX_ROOMS [:start_position] ||= 0 rooms = [] (1..MAX_BATCHES).each do current_batch = batch() rooms += current_batch [:start_position] += [:count] break if current_batch.size < [:count] end rooms end |
#batch(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/docusign_dtr/room.rb', line 26 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
47 |
# File 'lib/docusign_dtr/room.rb', line 47 def create(attrs = {}) end |
#destroy(id) ⇒ Object
49 |
# File 'lib/docusign_dtr/room.rb', line 49 def destroy(id) end |
#find(id) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/docusign_dtr/room.rb', line 40 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
36 37 38 |
# File 'lib/docusign_dtr/room.rb', line 36 def query_params() DocusignDtr::QueryParamHelper.call() end |
#update(attrs = {}) ⇒ Object
51 |
# File 'lib/docusign_dtr/room.rb', line 51 def update(attrs = {}) end |