Class: Glassfrog::Person
Overview
Encapsulates GlassFrog People.
Constant Summary collapse
- PATH =
'/people'
- TYPE =
:people
Instance Attribute Summary collapse
Attributes inherited from Base
Class Method Summary collapse
-
.delete(client, options) ⇒ Boolean
Sends a DELETE request to delete a Person on GlassFrog.
-
.get(client, options) ⇒ Array<Glassfrog::Person>
Sends a GET request for Person(s) to GlassFrog.
-
.patch(client, identifier, options) ⇒ Boolean
Sends a PATCH request to update a Person on GlassFrog.
-
.post(client, options) ⇒ Array<Glassfrog::Person>
Sends a POST request to create a Person on GlassFrog.
Methods inherited from Base
Methods included from Utils
#extract_id, #parameterize, #symbolize_keys
Constructor Details
This class inherits a constructor from Glassfrog::Base
Instance Attribute Details
#email ⇒ String
13 14 15 |
# File 'lib/glassfrog/person.rb', line 13 def email @email end |
#external_id ⇒ Integer
15 16 17 |
# File 'lib/glassfrog/person.rb', line 15 def external_id @external_id end |
#links ⇒ Hash
17 18 19 |
# File 'lib/glassfrog/person.rb', line 17 def links @links end |
#name ⇒ String
13 14 15 |
# File 'lib/glassfrog/person.rb', line 13 def name @name end |
Class Method Details
.delete(client, options) ⇒ Boolean
Sends a DELETE request to delete a Person on GlassFrog.
61 62 63 64 |
# File 'lib/glassfrog/person.rb', line 61 def self.delete(client, ) path = PATH + '/' + .delete(:id).to_s response = Glassfrog::REST::Delete.delete(client, path, ) end |
.get(client, options) ⇒ Array<Glassfrog::Person>
Sends a GET request for Person(s) to GlassFrog.
27 28 29 30 |
# File 'lib/glassfrog/person.rb', line 27 def self.get(client, ) response = Glassfrog::REST::Get.get(client, PATH, ) response[TYPE].map { |object| self.new(object) } end |
.patch(client, identifier, options) ⇒ Boolean
Sends a PATCH request to update a Person on GlassFrog.
50 51 52 53 |
# File 'lib/glassfrog/person.rb', line 50 def self.patch(client, identifier, ) = Glassfrog::REST::Patch.formify((), self) response = Glassfrog::REST::Patch.patch(client, PATH + '/' + identifier.to_s, ) end |
.post(client, options) ⇒ Array<Glassfrog::Person>
Sends a POST request to create a Person on GlassFrog.
38 39 40 41 |
# File 'lib/glassfrog/person.rb', line 38 def self.post(client, ) response = Glassfrog::REST::Post.post(client, PATH, { TYPE => [()] }) response[TYPE].map { |object| self.new(object) } end |