Class: Dotloop::Template
- Inherits:
-
Object
- Object
- Dotloop::Template
- Defined in:
- lib/dotloop/template.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #all(profile_id:) ⇒ Object
- #find(profile_id:, loop_template_id:) ⇒ Object
-
#initialize(client:) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(client:) ⇒ Template
Returns a new instance of Template.
7 8 9 |
# File 'lib/dotloop/template.rb', line 7 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/dotloop/template.rb', line 5 def client @client end |
Instance Method Details
#all(profile_id:) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/dotloop/template.rb', line 11 def all(profile_id:) @client.get("/profile/#{profile_id.to_i}/loop-template")[:data].map do |template_attrs| template = Dotloop::Models::Template.new(template_attrs) template.client = client template.profile_id = profile_id.to_i template end end |
#find(profile_id:, loop_template_id:) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/dotloop/template.rb', line 20 def find(profile_id:, loop_template_id:) template_data = @client.get("/profile/#{profile_id.to_i}/loop-template/#{loop_template_id.to_i}")[:data] template = Dotloop::Models::Template.new(template_data) template.client = client template.profile_id = profile_id.to_i template end |