Module: Immobilienscout24::Api::Contact
- Included in:
- Immobilienscout24::Api
- Defined in:
- lib/immobilienscout24/api/contact.rb
Overview
Methods for the Contact API
Per default the client will use the current user (‘me`). If you want to use an other user then you have to provide the id in the options hash.
Instance Method Summary collapse
-
#contact(id, options = {}) ⇒ Hashie::Mash
Get a contact.
-
#contact_endpoint(resource, options = {}) ⇒ String
Generates the contact endpoint.
-
#contacts(options = {}) ⇒ Hashie::Mash
Get a list of all contacts.
-
#create_contact(contact, options = {}) ⇒ Hashie::Mash
Create a contact.
-
#update_contact(id, contact, options = {}) ⇒ Hashie::Mash
Update a contact.
- #user_contact_endpoint(user, resource, options = {}) ⇒ Object
Instance Method Details
#contact(id, options = {}) ⇒ Hashie::Mash
Get a contact
35 36 37 |
# File 'lib/immobilienscout24/api/contact.rb', line 35 def contact(id, = {}) get contact_endpoint("/contact/#{id}", ) end |
#contact_endpoint(resource, options = {}) ⇒ String
Generates the contact endpoint
71 72 73 74 |
# File 'lib/immobilienscout24/api/contact.rb', line 71 def contact_endpoint(resource, = {}) = {user: "me"}.merge() user_contact_endpoint(.fetch(:user), resource, ) end |
#contacts(options = {}) ⇒ Hashie::Mash
Get a list of all contacts
23 24 25 |
# File 'lib/immobilienscout24/api/contact.rb', line 23 def contacts( = {}) get contact_endpoint("/contact", ) end |
#create_contact(contact, options = {}) ⇒ Hashie::Mash
Create a contact
47 48 49 |
# File 'lib/immobilienscout24/api/contact.rb', line 47 def create_contact(contact, = {}) post contact_endpoint("/contact", ), contact end |
#update_contact(id, contact, options = {}) ⇒ Hashie::Mash
Update a contact
60 61 62 |
# File 'lib/immobilienscout24/api/contact.rb', line 60 def update_contact(id, contact, = {}) put contact_endpoint("/contact/#{id}", ), contact end |
#user_contact_endpoint(user, resource, options = {}) ⇒ Object
76 77 78 |
# File 'lib/immobilienscout24/api/contact.rb', line 76 def user_contact_endpoint(user, resource, = {}) [user_endpoint("/user/#{user}"), resource].join end |