Class: Mints::Contact
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#add_item_to_shopping_cart(data, options = nil) ⇒ Object
Add Item To Shopping Cart.
-
#attach_follower(data) ⇒ Object
Attach Follower.
-
#attach_invitee(data) ⇒ Object
Attach Invitee.
-
#change_password(data) ⇒ Object
Change Password.
-
#create_appointment(data) ⇒ Object
Create Appointment.
-
#create_conversation(data) ⇒ Object
Create Conversation.
-
#create_message(data) ⇒ Object
Create Message.
-
#create_order(data) ⇒ Object
Create Order.
-
#create_order_item_group(data) ⇒ Object
Create Order Item Group.
-
#delete_order_item_group(id) ⇒ Object
Delete Order Item Group.
-
#detach_follower(data) ⇒ Object
Detach Follower.
-
#detach_invitee(data) ⇒ Object
Detach Invitee.
-
#detach_order_item_from_order_item_group(orderItemId, groupId) ⇒ Object
TODO: No tested === Detach Order Item From Order Item Group.
-
#get_appointment(id, options = nil) ⇒ Object
Get Appointment.
-
#get_appointments(options = nil) ⇒ Object
Get Appointments.
-
#get_conversation(id, options = nil) ⇒ Object
Get Conversation.
-
#get_conversation_participants(id) ⇒ Object
Get Conversation Participants.
-
#get_conversations(options = nil) ⇒ Object
Get Conversations.
-
#get_message(id, options = nil) ⇒ Object
Get Message.
-
#get_messages(options = nil) ⇒ Object
Get Messages.
-
#get_my_shopping_cart(options = nil) ⇒ Object
Get My Shopping Cart.
-
#get_order(id, options = nil) ⇒ Object
Get Order.
-
#get_order_item(id, options = nil) ⇒ Object
Get Order Item.
-
#get_order_item_group(id, options = nil) ⇒ Object
Get Order Item Group.
-
#get_order_item_groups(options = nil) ⇒ Object
Get Order Item Groups.
-
#get_order_items(options = nil) ⇒ Object
Get Order Items.
-
#get_orders(options = nil, use_post = true) ⇒ Object
Get Orders.
-
#initialize(host, api_key, session_token = nil, contact_token_id = nil, debug = false) ⇒ Contact
constructor
Initialize.
-
#login(email, password) ⇒ Object
Login.
-
#logout ⇒ Object
Logout.
-
#magic_link_login(token) ⇒ Object
Magic Link Login.
-
#me(options = nil) ⇒ Object
Me.
-
#oauth_login(data) ⇒ Object
OAuth Login.
-
#recover_password(data) ⇒ Object
Recover Password.
-
#register(data) ⇒ Object
Register.
-
#reset_password(data) ⇒ Object
Reset Password.
-
#scheduled_appointments(data) ⇒ Object
Scheduled Appointments.
-
#send_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email') ⇒ Object
Send Magic Link.
-
#status ⇒ Object
Status.
-
#sync_follower(data) ⇒ Object
Sync Follower.
-
#sync_invitee(data) ⇒ Object
Sync Invitee.
-
#update(data) ⇒ Object
Update.
-
#update_appointment(id, data) ⇒ Object
Update Appointment.
-
#update_conversation(id, data) ⇒ Object
Update Conversation.
-
#update_conversation_status(id, data) ⇒ Object
Update Conversation Status.
-
#update_order(id, data) ⇒ Object
Update Order.
-
#update_order_item_from_order_item_group(orderItemId, groupId, data) ⇒ Object
TODO: No tested === Update Order Item From Order Item Group.
-
#update_order_item_group(id, data) ⇒ Object
Update Order Item Group.
Methods included from MintsHelper
#correct_json, #data_transform, #get_query_results
Constructor Details
#initialize(host, api_key, session_token = nil, contact_token_id = nil, debug = false) ⇒ Contact
Initialize.
Class constructor.
Parameters
- host
-
(String) – It’s the visitor IP.
- api_key
-
(String) – Mints instance api key.
- contact_token_id
-
(Integer) – Cookie ‘mints_contact_id’ value (mints_contact_token).
Return
Returns a Contact object
18 19 20 21 |
# File 'lib/contact.rb', line 18 def initialize(host, api_key, session_token = nil, contact_token_id = nil, debug = false) @contact_v1_url = '/api/contact/v1' @client = Mints::Client.new(host, api_key, "contact", session_token, contact_token_id, nil, debug) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/contact.rb', line 6 def client @client end |
Instance Method Details
#add_item_to_shopping_cart(data, options = nil) ⇒ Object
Add Item To Shopping Cart.
Add an item into a shopping cart.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"quantity": 1,
"sku_id": 1,
"price_list_id": 1
}
@data = @mints_contact.add_item_to_shopping_cart(data)
677 678 679 |
# File 'lib/contact.rb', line 677 def add_item_to_shopping_cart(data, = nil) @client.raw("post", "/ecommerce/shopping-cart", , data_transform(data), @contact_v1_url) end |
#attach_follower(data) ⇒ Object
Attach Follower.
Attach follower to an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"follower_ids": 1
}
@data = @mints_contact.attach_follower(data)
480 481 482 |
# File 'lib/contact.rb', line 480 def attach_follower(data) @client.raw("post", "/contacts/appointments/attach-follower", nil, data_transform(data)) end |
#attach_invitee(data) ⇒ Object
Attach Invitee.
Attach invitee to an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"invitee_ids": 1
}
@data = @mints_contact.attach_invitee(data)
463 464 465 |
# File 'lib/contact.rb', line 463 def attach_invitee(data) @client.raw("post", "/contacts/appointments/attach-invitee", nil, data_transform(data)) end |
#change_password(data) ⇒ Object
Change Password.
Change password without email. To change the password a contact must be logged.
Parameters
- data
-
(Hash) – A new password allocated in a data key.
Example
data = { "password": "new_password" }
@data = @mints_contact.change_password(data)
230 231 232 |
# File 'lib/contact.rb', line 230 def change_password(data) @client.raw("post", "/change-password", nil, data_transform(data), @contact_v1_url) end |
#create_appointment(data) ⇒ Object
Create Appointment.
Create an appointment with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"object_model": "products",
"object_id": 1,
"title": "New Appointment",
"start": "2021-11-25T14:15:00+00:00",
"end": "2022-01-01T13:00:00+00:00"
}
@data = @mints_contact.create_appointment(data)
410 411 412 |
# File 'lib/contact.rb', line 410 def create_appointment(data) @client.raw("post", "/contacts/appointments", nil, data_transform(data)) end |
#create_conversation(data) ⇒ Object
Create Conversation.
Create a conversation with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"title": "New Conversation To Test"
}
@data = @mints_contact.create_conversation(data)
271 272 273 |
# File 'lib/contact.rb', line 271 def create_conversation(data) @client.raw("post", "/content/conversations", nil, data_transform(data), @contact_v1_url) end |
#create_message(data) ⇒ Object
Create Message.
Create a message with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"conversation_id": 3,
"type": "text",
"value": {
"text": "Message Text"
}
}
@data = @mints_contact.(data)
350 351 352 |
# File 'lib/contact.rb', line 350 def (data) @client.raw("post", "/content/messages", nil, data_transform(data), @contact_v1_url) end |
#create_order(data) ⇒ Object
Create Order.
Create a order with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"order_template_id": 1,
"order_status_id": 1,
"sales_channel_id": 1
}
@data = @mints_pub.create_order(data)
612 613 614 |
# File 'lib/contact.rb', line 612 def create_order(data) @client.raw("post", "/ecommerce/orders", nil, data_transform(data), @contact_v1_url) end |
#create_order_item_group(data) ⇒ Object
Create Order Item Group.
Create an order item group with data if you are related to that order.
Parameters
- data
-
(Hash) – Data to be submitted.
First Example
data = {
"name": "New Order Item Group",
"quantity": 1,
"order_id": 1,
"on_sale_price": 100
}
@data = @mints_contact.create_order_item_group(data)
Second Example
data = {
"name": "",
"quantity": 1,
"order_id": 1,
"sku_id": 1
}
@data = @mints_contact.create_order_item_group(data)
760 761 762 |
# File 'lib/contact.rb', line 760 def create_order_item_group(data) @client.raw("post", "/ecommerce/order-items-groups", nil, data_transform(data), @contact_v1_url) end |
#delete_order_item_group(id) ⇒ Object
Delete Order Item Group.
Delete an order item group. FIXME: This method doesn’t work. Throw no action error.
785 786 787 |
# File 'lib/contact.rb', line 785 def delete_order_item_group(id) @client.raw("delete", "/ecommerce/order-items-groups/#{id}", nil, nil, @contact_v1_url) end |
#detach_follower(data) ⇒ Object
Detach Follower.
Detach follower from an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"follower_ids": 1
}
@data = @mints_contact.detach_follower(data)
514 515 516 |
# File 'lib/contact.rb', line 514 def detach_follower(data) @client.raw("post", "/contacts/appointments/detach-follower", nil, data_transform(data)) end |
#detach_invitee(data) ⇒ Object
Detach Invitee.
Detach invitee from an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"invitee_ids": 1
}
@data = @mints_contact.detach_invitee(data)
497 498 499 |
# File 'lib/contact.rb', line 497 def detach_invitee(data) @client.raw("post", "/contacts/appointments/detach-invitee", nil, data_transform(data)) end |
#detach_order_item_from_order_item_group(orderItemId, groupId) ⇒ Object
TODO: No tested
Detach Order Item From Order Item Group.
Detach an order item from an order item group.
Parameters
- orderItemId
-
(Integer) – Order item id.
- groupId
-
(Integer) – Order items group id.
636 637 638 |
# File 'lib/contact.rb', line 636 def detach_order_item_from_order_item_group(orderItemId, groupId) @client.raw("put", "/ecommerce/order-items/detach/#{orderItemId}/order-items-groups/#{groupId}", nil, nil, @contact_v1_url) end |
#get_appointment(id, options = nil) ⇒ Object
Get Appointment.
Get an appointment info.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_contact.get_appointment(1)
Second Example
= {
"fields": "id, created_at"
}
@data = @mints_contact.get_appointment(1, )
390 391 392 |
# File 'lib/contact.rb', line 390 def get_appointment(id, = nil) @client.raw("get", "/contacts/appointments/#{id}", ) end |
#get_appointments(options = nil) ⇒ Object
Get Appointments.
Get a collection of appointments.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_contact.get_appointments
Second Example
= {
"fields": "id, created_at"
}
@data = @mints_contact.get_appointments()
371 372 373 |
# File 'lib/contact.rb', line 371 def get_appointments( = nil) @client.raw("get", "/contacts/appointments", ) end |
#get_conversation(id, options = nil) ⇒ Object
Get Conversation.
Get a conversation info.
Parameters
- id
-
(Integer) – Conversation id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
FIXME: This method doesn’t return data.
255 256 257 |
# File 'lib/contact.rb', line 255 def get_conversation(id, = nil) @client.raw("get", "/content/conversations/#{id}", , nil, @contact_v1_url) end |
#get_conversation_participants(id) ⇒ Object
Get Conversation Participants.
Update a conversation participants.
Parameters
- id
-
(Integer) – Conversation id.
FIXME: This method doesn’t locate conversation id to be updated.
306 307 308 309 |
# File 'lib/contact.rb', line 306 def get_conversation_participants(id) #TODO: Test if this method needs data in options. @client.raw("get", "/content/conversations/#{id}/participants", nil, nil, @contact_v1_url) end |
#get_conversations(options = nil) ⇒ Object
Get Conversations.
Get a collection of conversations.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
FIXME: This method doesn’t return data.
243 244 245 |
# File 'lib/contact.rb', line 243 def get_conversations( = nil) @client.raw("get", "/content/conversations", , nil, @contact_v1_url) end |
#get_message(id, options = nil) ⇒ Object
Get Message.
Get a message info.
Parameters
- id
-
(Integer) – Message id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
FIXME: This method doesn’t return data.
330 331 332 |
# File 'lib/contact.rb', line 330 def (id, = nil) @client.raw("get", "/content/messages/#{id}", , nil, @contact_v1_url) end |
#get_messages(options = nil) ⇒ Object
Get Messages.
Get a collection of messages.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
FIXME: This method doesn’t return data.
318 319 320 |
# File 'lib/contact.rb', line 318 def ( = nil) @client.raw("get", "/content/messages", , nil, @contact_v1_url) end |
#get_my_shopping_cart(options = nil) ⇒ Object
Get My Shopping Cart.
Get a collection of items in the shopping cart.
Example
@data = @mints_contact.get_my_shopping_cart
FIXME: This method returns a nil data.
659 660 661 |
# File 'lib/contact.rb', line 659 def get_my_shopping_cart( = nil) @client.raw("get", "/ecommerce/my-shopping-cart", , nil, @contact_v1_url) end |
#get_order(id, options = nil) ⇒ Object
Get Order.
Get an order info.
Parameters
- id
-
(Integer) – Order id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_pub.get_product(25)
Second Example
= {
"fields": "title"
}
@data = @mints_pub.get_product(25, )
594 595 596 |
# File 'lib/contact.rb', line 594 def get_order(id, = nil) @client.raw("get", "/ecommerce/orders/#{id}", , nil, @contact_v1_url) end |
#get_order_item(id, options = nil) ⇒ Object
Get Order Item.
Get an order item info. TODO: Find a way to show order items.
693 694 695 |
# File 'lib/contact.rb', line 693 def get_order_item(id, = nil) @client.raw("get", "/ecommerce/order-items/#{id}", , nil, @contact_v1_url) end |
#get_order_item_group(id, options = nil) ⇒ Object
Get Order Item Group.
Get an order item group info.
Parameters
- id
-
(Integer) – Order Item Group Id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_contact.get_order_item_group(130)
Second Example
= {
"fields": "id"
}
@data = @mints_contact.get_order_item_group(130, )
732 733 734 |
# File 'lib/contact.rb', line 732 def get_order_item_group(id, = nil) @client.raw("get", "/ecommerce/order-items-groups/#{id}", , nil, @contact_v1_url) end |
#get_order_item_groups(options = nil) ⇒ Object
Get Order Item Groups.
Get a collection of order item groups.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_contact.get_order_item_groups
Second Example
= {
"fields": "id"
}
@data = @mints_contact.get_order_item_groups()
712 713 714 |
# File 'lib/contact.rb', line 712 def get_order_item_groups( = nil) @client.raw("get", "/ecommerce/order-items-groups", , nil, @contact_v1_url) end |
#get_order_items(options = nil) ⇒ Object
Get Order Items.
Get a collection of order items. TODO: Find a way to show order items.
685 686 687 |
# File 'lib/contact.rb', line 685 def get_order_items( = nil) @client.raw("get", "/ecommerce/order-items", , nil, @contact_v1_url) end |
#get_orders(options = nil, use_post = true) ⇒ Object
Get Orders.
Get a collection of orders.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
- use_post
-
(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.
First Example
@data = @mints_pub.get_orders
Second Example
= { "fields": "title" }
@data = @mints_pub.get_orders()
Third Example
= { "fields": "title" }
@data = @mints_pub.get_orders(, false)
570 571 572 573 574 575 576 |
# File 'lib/contact.rb', line 570 def get_orders( = nil, use_post = true) if use_post @client.raw("post", "/ecommerce/orders/query", , nil, @contact_v1_url) else @client.raw("get", "/ecommerce/orders", , nil, @contact_v1_url) end end |
#login(email, password) ⇒ Object
Login.
Starts a contact session.
Parameters
-
(String) – The email that will be logged.
- password
-
(String) – The password of the email.
Example
@mints_contact.login("email@example.com", "password")
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/contact.rb', line 54 def login(email, password) data = { email: email, password: password } response = @client.raw("post", "/contacts/login", nil, {data: data}.to_json) if response.key? "session_token" @client.session_token = response["session_token"] end return response end |
#logout ⇒ Object
Logout.
Ends a contact session previously logged.
Example
@data = @mints_contact.logout
212 213 214 215 216 217 218 |
# File 'lib/contact.rb', line 212 def logout response = @client.raw("post", "/logout", nil, nil, @contact_v1_url) if session_token? if response["success"] @client.session_token = nil end return response end |
#magic_link_login(token) ⇒ Object
Magic Link Login.
Starts a contact session with a token received in the contact email. The token will be received by send_magic_link method.
Parameters
- token
-
(String) – The email token that will be used to log in.
Example
@mints_contact.magic_link_login(
"d8618c6d-a165-41cb-b3ec-d053cbf30059:zm54HtRdfHED8dpILZpjyqjPIceiaXNLfOklqM92fveBS0nDtyPYBlI4CPlPe3zq"
)
117 118 119 120 121 122 123 |
# File 'lib/contact.rb', line 117 def magic_link_login(token) response = @client.raw("get", "/contacts/magic-link-login/#{token}", nil, '/api/v1') if response.key? "session_token" @client.session_token = response["session_token"] end return response end |
#me(options = nil) ⇒ Object
Me.
Get contact logged info.
Parameters
- # options
-
(Hash) – List of Resource collection Options shown above can be used as parameter.
First Example
@data = @mints_contact.me
Second Example
= {
"attributes": true,
"taxonomies": true
}
@data = @mints_contact.me()
175 176 177 |
# File 'lib/contact.rb', line 175 def me( = nil) @client.raw("get", "/me", , nil, @contact_v1_url) end |
#oauth_login(data) ⇒ Object
OAuth Login.
Login a contact using oauth.
102 103 104 |
# File 'lib/contact.rb', line 102 def oauth_login(data) @client.raw("post", "/contacts/oauth-login", nil, data) end |
#recover_password(data) ⇒ Object
Recover Password.
Send a email that contains a token to a contact. That token will be used in reset_password to establish a new password.
Parameters
- data
-
(Hash) – It’s a data key where will be hosted the destination email.
Example
data = { "email": "email@example.com" }
@mints_contact.recover_password(data)
76 77 78 |
# File 'lib/contact.rb', line 76 def recover_password(data) @client.raw("post", "/contacts/recover-password", nil, data_transform(data)) end |
#register(data) ⇒ Object
Register.
Register a contact.
Parameters
- data
-
(Hash) – It’s the register data.
Example
data = {
"email": "email@example.com",
"given_name": "Given Name",
"last_name": "Last Name",
"password": "password"
}
@mints_contact.register(data);
40 41 42 |
# File 'lib/contact.rb', line 40 def register(data) @client.raw("post", "/contacts/register", nil, data_transform(data)) end |
#reset_password(data) ⇒ Object
Reset Password.
Reset password using a token. The token is obtained by recover_password method.
Parameters
- data
-
(Hash) – It’s a set of data which contains all the information to reset a contact password.
Example
data = {
"email": "email@example.com",
"password": "password",
"password_confirmation": "password",
"token": "644aa3aa0831d782cc42e42b11aedea9a2234389af4f429a8d96651295ecfa09"
}
@mints_contact.reset_password(data)
95 96 97 |
# File 'lib/contact.rb', line 95 def reset_password(data) @client.raw("post", "/contacts/reset-password", nil, data_transform(data)) end |
#scheduled_appointments(data) ⇒ Object
Scheduled Appointments.
Get a collection of appointments filtering by object_type, object_id and dates range.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"object_model": "products",
"object_id": 2,
"start": "2021-11-25T14:15:00+00:00",
"end": "2022-01-01T13:00:00+00:00"
}
@data = @mints_contact.scheduled_appointments(data)
446 447 448 |
# File 'lib/contact.rb', line 446 def scheduled_appointments(data) @client.raw("post", "/contacts/appointments/scheduled-appointments", nil, data_transform(data)) end |
#send_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email') ⇒ Object
Send Magic Link.
Send magic link to contact by email. That magic link will be used in magic_link_login method.
Parameters
- email_or_phone
-
(String) – Contact’s email.
- template_slug
-
(String) – Email template’s slug to be used in the email.
- redirectUrl
-
(String) – Url to be redirected in the implemented page.
- lifeTime
-
(Integer) – Maximum time of use in minutes.
- maxVisits
-
(Integer) – The maximum number of uses of a token.
First Example
@mints_contact.send_magic_link("email@example.com", "template_slug")
Second Example
@mints_contact.send_magic_link("+526561234567", "template_slug", "", 1440, 3, 'whatsapp')
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/contact.rb', line 141 def send_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email') data = { driver: driver, lifeTime: life_time, maxVisits: max_visits, redirectUrl: redirect_url, templateId: template_slug } if driver === 'sms' or driver === 'whatsapp' data['phone'] = email_or_phone else data['email'] = email_or_phone end @client.raw("post", "/contacts/magic-link", nil, { data: data }.to_json, '/api/v1') end |
#status ⇒ Object
Status.
Get contact logged status.
Example
@data = @mints_contact.status
185 186 187 |
# File 'lib/contact.rb', line 185 def status @client.raw("get", "/status", nil, nil, @contact_v1_url) end |
#sync_follower(data) ⇒ Object
Sync Follower.
Sync a follower from an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"follower_ids": 1
}
@data = @mints_contact.sync_follower(data)
548 549 550 |
# File 'lib/contact.rb', line 548 def sync_follower(data) @client.raw("post", "/contacts/appointments/sync-follower", nil, data_transform(data)) end |
#sync_invitee(data) ⇒ Object
Sync Invitee.
Sync an invitee from an appointment.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
"appointment_id": 1,
"invitee_ids": 1
}
@data = @mints_contact.sync_invitee(data)
531 532 533 |
# File 'lib/contact.rb', line 531 def sync_invitee(data) @client.raw("post", "/contacts/appointments/sync-invitee", nil, data_transform(data)) end |
#update(data) ⇒ Object
Update.
Update logged contact attributes.
Parameters
- data
-
(Hash) – It’s the data to update with a session active.
Example
data = {
"given_name": "Given Name",
"last_name": "Last Name"
}
@data = @mints_contact.update(data)
202 203 204 |
# File 'lib/contact.rb', line 202 def update(data) @client.raw("put", "/update", nil, data_transform(data), @contact_v1_url) end |
#update_appointment(id, data) ⇒ Object
Update Appointment.
Update an appointment info.
Parameters
- id
-
(Integer) – Appointment id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
"object_id": 2
}
@data = @mints_contact.update_appointment(1, data)
427 428 429 |
# File 'lib/contact.rb', line 427 def update_appointment(id, data) @client.raw("put", "/contacts/appointments/#{id}", nil, data_transform(data)) end |
#update_conversation(id, data) ⇒ Object
Update Conversation.
Update a location template info.
Parameters
- id
-
(Integer) – Conversation id.
- data
-
(Hash) – Data to be submitted.
FIXME: This method doesn’t locate conversation id to be updated.
283 284 285 |
# File 'lib/contact.rb', line 283 def update_conversation(id, data) @client.raw("put", "/content/conversations/#{id}", nil, data_transform(data), @contact_v1_url) end |
#update_conversation_status(id, data) ⇒ Object
Update Conversation Status.
Update a conversation status.
Parameters
- id
-
(Integer) – Conversation id.
- data
-
(Hash) – Data to be submitted.
FIXME: This method doesn’t locate conversation id to be updated.
295 296 297 |
# File 'lib/contact.rb', line 295 def update_conversation_status(id, data) @client.raw("put", "/content/conversations/#{id}/status", nil, data_transform(data), @contact_v1_url) end |
#update_order(id, data) ⇒ Object
Update Order.
Update an order info.
Parameters
- id
-
(Integer) – Order Id
- data
-
(Hash) – Data to be submitted.
FIXME: This method doesnt update an order.
624 625 626 |
# File 'lib/contact.rb', line 624 def update_order(id, data) @client.raw("put", "/ecommerce/orders/#{id}", nil, data_transform(data), @contact_v1_url) end |
#update_order_item_from_order_item_group(orderItemId, groupId, data) ⇒ Object
TODO: No tested
Update Order Item From Order Item Group.
Update an order item data from an order item group.
Parameters
- orderItemId
-
(Integer) – Order item id.
- groupId
-
(Integer) – Order items group id.
648 649 650 |
# File 'lib/contact.rb', line 648 def update_order_item_from_order_item_group(orderItemId, groupId, data) @client.raw("put", "/ecommerce/order-items/update/#{orderItemId}/order-items-groups/#{groupId}", nil, data_transform(data), @contact_v1_url) end |
#update_order_item_group(id, data) ⇒ Object
Update Order Item Group.
Update an order item group info if you are related to that order.
Parameters
- id
-
(Integer) – Order Item Group Id.
- data
-
(Hash) – Data to be submitted.
First Example
data = {
"name": "New Order Item Group Name Updated"
}
@data = @mints_contact.update_order_item_group(130, data)
777 778 779 |
# File 'lib/contact.rb', line 777 def update_order_item_group(id, data) @client.raw("put", "/ecommerce/order-items-groups/#{id}", nil, data_transform(data), @contact_v1_url) end |