Class: Mints::User
- Inherits:
-
Object
- Object
- Mints::User
- Defined in:
- lib/user.rb
Overview
User context API
User class contains functions that needs an API key and a session token as authentication
Usage example
Initialize
client = Mints::User.new(mints_url, api_key)
Call any function
client.get_contacts
Single resource options
-
include
- [String] include a relationship -
attributes
- [Boolean] attach attributes to response -
tags
- [Boolean] attach tags to response -
taxonomies
- [Boolean] attach categories to response
Resource collections options
-
search
- [String] filter by a search word -
scopes
- [String] filter by a scope -
filters
- [String] filter by where clauses -
jfilters
- [String] filter using complex condition objects (this filter use mongo queries) -
afilters
- [String] filter using complex condition objects (this filter use postgresql queries) -
rfilters
- [String] filter using complex condition objects from relationships -
dfilters
- [String] filter using conditions based on dates -
fields
- [String] indicates the columns that will be selected -
sort
- [String] indicates the columns that will be selected
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(host, api_key, session_token = nil, debug = false) ⇒ User
constructor
A new instance of User.
- #login(email, password) ⇒ Object
- #magic_link_login(token) ⇒ Object
-
#send_magic_link(email, redirect_url = '', life_time = 24) ⇒ Object
Send magic link to user.
Methods included from MintsHelper
#correct_json, #data_transform, #get_query_results
Methods included from Contacts
#change_password_no_auth, #create_contact, #create_contact_deal, #create_contact_user, #delete_contact_deal, #delete_contact_user, #delete_contacts, #get_contact, #get_contact_deal, #get_contact_magic_links, #get_contact_segments, #get_contact_submissions, #get_contact_tags, #get_contact_user, #get_contacts, #get_contacts_support_data, #get_online_activity, #merge_contacts, #send_magic_links, #update_contact
Methods included from Helpers
#generate_seed, #get_activities_by_object_type_and_id, #get_available_types_from_usage, #get_dice_coefficient, #get_magic_link_config, #get_permission_menu, #slugify
Methods included from UserFolders
#create_user_folder, #delete_user_folder, #get_user_folder, #get_user_folders, #update_user_folder
Methods included from ObjectFolders
#create_object_folder, #delete_object_folder, #get_object_folder, #get_object_folders, #update_object_folder
Methods included from ObjectActivities
#create_object_activity, #delete_object_activity, #get_object_activities, #get_object_activity, #update_object_activity
Methods included from Profile
#create_preferences, #delete_notifications, #get_notifications, #get_preferences, #get_preferences_by_setting_key, #me, #read_notifications
Methods included from Users
#can_users_coach, #create_user, #get_crm_users, #get_user, #get_users, #update_user
Methods included from Teams
#create_team, #get_team, #get_team_types, #get_teams, #update_team
Methods included from Taxonomies
#create_taxonomy, #get_taxonomies, #get_taxonomies_for_object, #get_taxonomies_support_data, #get_taxonomy, #sync_taxonomies_for_object, #update_taxonomy
Methods included from Tags
#create_tag, #get_tag, #get_tags, #update_tag
Methods included from SystemSettings
#clear_tag, #create_setting, #get_settings, #get_settings_by_keys
Methods included from Seeds
#apply_seeds, #get_seed_process, #get_seed_processes
Methods included from Roles
#create_role, #duplicate_role, #get_role, #get_roles, #update_role
Methods included from Relationships
#attach_relationship, #create_relationship, #delete_relationship, #detach_relationship, #get_relationship, #get_relationships, #get_relationships_available_for, #relationship_has_objects, #update_relationship
Methods included from PublicFolders
#create_public_folder, #get_public_folder, #get_public_folder_support_data, #get_public_folders, #get_public_folders_for_object, #sync_public_folders_for_object, #update_public_folder
Methods included from Calendars
#create_calendar, #delete_calendar, #get_calendar, #get_calendars, #update_calendar
Methods included from Attributes
#create_attribute, #get_attribute, #get_attributes, #get_attributes_data_types, #get_sub_attributes, #update_attribute
Methods included from AttributeGroups
#create_attribute_group, #get_attribute_group, #get_attribute_groups, #get_attribute_groups_data_types, #update_attribute_group
Methods included from Appointments
#attach_follower, #attach_invitee, #create_appointment, #delete_appointment, #detach_follower, #detach_invitee, #get_appointment, #get_appointments, #reschedule_appointment, #scheduled_appointments, #sync_follower, #sync_invitee, #update_appointment
Methods included from ApiKeys
#create_api_key, #delete_api_key, #get_api_key, #get_api_keys
Methods included from OrderItems
#get_order_item, #get_order_items
Methods included from VariantValues
#create_variant_value, #get_variant_value, #get_variant_values, #update_variant_value
Methods included from VariantOptions
#create_variant_option, #get_variant_option, #get_variant_options, #update_variant_option
Methods included from Taxes
#create_tax, #delete_tax, #get_tax, #get_taxes, #update_tax
Methods included from Skus
#create_sku, #delete_sku, #get_sku, #get_skus, #update_sku
Methods included from Products
#create_product, #delete_product, #get_product, #get_product_variant_options_config, #get_products, #get_products_support_data, #publish_product, #revert_published_product, #schedule_product, #update_product, #update_product_variations_config
Methods included from ProductVariations
#create_product_variation, #delete_product_variation, #generate_product_variation, #get_product_from_product_variation, #get_product_variation, #get_product_variations, #set_prices_to_product_variations, #update_product_variation
Methods included from ProductTemplates
#create_product_template, #get_product_template, #get_product_templates, #get_product_templates_support_data, #get_product_templates_support_data_from_order_items_group, #get_product_templates_support_data_from_product, #update_product_template
Methods included from PriceList
#create_price_list, #get_price_list, #get_price_lists, #update_price_list
Methods included from Orders
#add_item_to_shopping_cart, #create_order, #delete_orders, #detach_order_item_from_order_item_group, #duplicate_order, #get_my_shopping_cart, #get_order, #get_order_item, #get_order_items, #get_order_items_support_data, #get_order_template, #get_order_template_support_data, #get_order_templates, #get_orders, #get_orders_support_data, #update_order, #update_order_item, #update_order_item_from_order_item_group, #update_order_template
Methods included from OrderStatuses
#get_order_status, #get_order_statuses
Methods included from OrderItemsGroups
#create_order_item_group, #delete_order_item_group, #get_order_item_group, #get_order_item_group_support_data_by_order_id, #get_order_item_groups, #get_pending_order_template_from_order_item_group, #update_order_item_group
Methods included from Locations
#create_location, #create_location_template, #delete_location, #get_location, #get_location_template, #get_location_template_support_data, #get_location_templates, #get_location_templates_support_data, #get_locations, #update_location, #update_location_template
Methods included from ItemPrices
#create_item_price, #delete_item_price, #get_item_price, #get_item_prices, #update_item_price
Methods included from Marketing
#create_automation, #delete_automation, #duplicate_automation, #get_automation, #get_automation_executions, #get_automations, #reset_automation, #update_automation
Methods included from Content
#create_author, #create_keyword, #create_stage, #get_author, #get_authors, #get_keyword, #get_keywords, #get_public_images_url, #get_stage, #get_stages, #update_author, #update_keyword, #update_stage
Methods included from StoryTemplates
#create_story_template, #get_story_template, #get_story_template_support_data, #get_story_templates, #get_story_templates_support_data, #update_story_template
Methods included from StoryVersions
#create_story_version, #delete_story_version, #duplicate_story_version, #get_story_version, #get_story_versions, #publish_story_version, #update_story_version
Methods included from Stories
#create_story, #delete_story, #duplicate_story, #get_stories, #get_story, #update_story
Methods included from Pages
#create_page, #delete_page, #get_bundles, #get_page, #get_page_groups, #get_pages, #update_page
Methods included from Messages
#create_message, #delete_message, #get_message, #get_messages, #update_message
Methods included from MessageTemplates
#create_message_template, #delete_message_template, #duplicate_message_template, #get_driver_templates, #get_message_template, #get_message_templates, #get_recipient_variables, #get_variables_of_content_page_from_message_templates, #preview_message_template, #send_message_template, #update_message_template
Methods included from Forms
#create_form, #delete_form, #delete_form_submission, #duplicate_form, #get_form, #get_form_activation_words, #get_form_aggregates, #get_form_submission, #get_form_submissions, #get_form_support_data, #get_forms, #publish_form, #reset_form_aggregates, #revert_published_form, #schedule_form, #update_form
Methods included from DAM
#create_dam_folder, #delete_dam, #get_dam_asset_locations, #get_dam_load_tree, #paste_dam, #rename_dam, #search_dam, #send_to_trash_dam
Methods included from Conversations
#attach_contact_in_conversation, #attach_form_in_conversation, #attach_user_in_conversation, #create_conversation, #create_message, #delete_conversation, #detach_contact_in_conversation, #detach_form_in_conversation, #detach_user_in_conversation, #get_conversation, #get_conversation_participants, #get_conversations, #get_message, #get_messages, #update_conversation, #update_conversation_status
Methods included from ContentTemplates
#create_content_template, #delete_content_template, #duplicate_content_template, #get_content_template, #get_content_template_instances, #get_content_templates, #update_content_template
Methods included from ContentInstances
#create_content_instance, #delete_content_instance, #duplicate_content_instance, #get_content_instance, #get_content_instances, #publish_content_instance, #revert_published_content_instance, #schedule_content_instance, #update_content_instance
Methods included from Assets
#create_asset, #create_asset_size, #delete_asset, #download_asset, #generate_asset_variation, #get_asset, #get_asset_doc_types, #get_asset_info, #get_asset_link_info, #get_asset_public_route, #get_asset_size, #get_asset_sizes, #get_asset_thumbnails, #get_asset_usage, #get_asset_variation, #get_assets, #update_asset, #upload_asset
Methods included from Workflows
#create_workflow, #get_workflow, #get_workflows, #update_workflow
Methods included from WorkFlowSteps
#create_workflow_step, #delete_workflow_step, #update_workflow_step
Methods included from WorkflowStepObjects
#create_step_object, #get_step_object, #get_step_object_by_object_type, #get_step_objects, #update_step_object
Methods included from Segments
#create_segment, #delete_segment, #duplicate_segment, #get_segment, #get_segment_group, #get_segments, #get_segments_attributes, #get_segments_support_data, #update_segment
Methods included from Favorites
#get_favorites, #update_favorites, #update_multiple_favorites
Methods included from Deals
#create_deal, #get_deal, #get_deal_currencies, #get_deal_permits, #get_deal_support_data, #get_deals, #update_deal
Methods included from Companies
#create_company, #delete_companies, #get_companies, #get_companies_support_data, #get_company, #update_company
Constructor Details
permalink #initialize(host, api_key, session_token = nil, debug = false) ⇒ User
Returns a new instance of User.
52 53 54 |
# File 'lib/user.rb', line 52 def initialize(host, api_key, session_token = nil, debug = false) @client = Mints::Client.new(host, api_key, 'user', session_token, nil, nil, debug) end |
Instance Attribute Details
permalink #client ⇒ Object (readonly)
Returns the value of attribute client.
50 51 52 |
# File 'lib/user.rb', line 50 def client @client end |
Instance Method Details
permalink #login(email, password) ⇒ Object
[View source]
56 57 58 59 60 61 62 |
# File 'lib/user.rb', line 56 def login(email, password) data = { email: email, password: password } response = @client.raw('post', '/users/login', nil, data.to_json, '/api/v1', { no_content_type: true }) @client.session_token = response['api_token'] if response.key? 'api_token' response end |
permalink #magic_link_login(token) ⇒ Object
[View source]
64 65 66 |
# File 'lib/user.rb', line 64 def magic_link_login(token) @client.raw('get', "/users/magic-link-login/#{token}", nil, nil, '/api/v1') end |
permalink #send_magic_link(email, redirect_url = '', life_time = 24) ⇒ Object
Send magic link to user
70 71 72 73 74 75 76 77 |
# File 'lib/user.rb', line 70 def send_magic_link(email, redirect_url = '', life_time = 24) data = { email: email, redirectUrl: redirect_url, lifeTime: life_time } @client.raw('post', '/users/magic-link', nil, { data: data }, '/api/v1') end |