=begin #Smooch #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). OpenAPI spec version: 4.1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3-SNAPSHOT =end require 'date' module SmoochApi class IntegrationCreate # The integration type. attr_accessor :type # Facebook Page Access Token. Required for *messenger* integrations. attr_accessor :page_access_token # Facebook App ID OR WeChat App ID. Required for *messenger* and *wechat* integrations. attr_accessor :app_id # Facebook Page App Secret OR WeChat App Secret. Required for *messenger* and *wechat* integrations. attr_accessor :app_secret # Twilio Account SID. Required for *twilio* integrations. attr_accessor :account_sid # Twilio Auth Token. Required for *twilio* integrations. attr_accessor :auth_token # Your WhatsApp API client's URL. Required for *WhatsApp* integrations. attr_accessor :base_url # Specification of a fallback language. (Optional) Used for *WhatsApp* integrations. attr_accessor :hsm_fallback_language # SID for specific phone number. Required for *twilio* integrations. attr_accessor :phone_number_sid # Telegram Bot Token OR Viber Public Account token. Required for *twilio* and *viber* integrations. attr_accessor :token # LINE Channel ID. Required for *line* integrations. attr_accessor :channel_id # LINE Channel Secret. Required for *line* integrations. attr_accessor :channel_secret # LINE Channel Access Token. Required for *line* integrations. attr_accessor :channel_access_token # AES Encoding Key. (Optional) Used for *wechat* integrations. attr_accessor :encoding_aes_key # Email will display as coming from this address. (Optional) Used for *frontendEmail* integrations. attr_accessor :from_address # The binary of your APN certificate base64 encoded. Required for *apn* integrations. attr_accessor :certificate # The password for your APN certificate or WhatsApp API client. Required for *WhatsApp* integrations. (Optional) Used for *apn* integrations. attr_accessor :password # The username for the account. Required for *WhatsApp* integrations. Returned on successful *twitter* and *telegram* integrations. attr_accessor :username # Use the unread count of the conversation as the application badge. (Optional) Used for *apn* integrations. attr_accessor :auto_update_badge # Your server key from the fcm console. Required for *fcm* integrations. attr_accessor :server_key # Your sender id from the fcm console. Required for *fcm* integrations. attr_accessor :sender_id # Your Twitter app’s tier. Accepted values are enterprise or premium. attr_accessor :tier # The Twitter environment name, e.g.: env-beta. Required for *twitter* integrations with *premium* tier. attr_accessor :env_name # The consumer key for your Twitter app. Required for *twitter* integrations. attr_accessor :consumer_key # The consumer secret for your Twitter app. Required for *twitter* integrations. attr_accessor :consumer_secret # The access token key obtained from your user via oauth. Required for *twitter* integrations. attr_accessor :access_token_key # The access token secret obtained from your user via oauth. Required for *twitter* integrations. attr_accessor :access_token_secret # Optional endpoint to generate access tokens for WeChat. Used to coordinate API access with third party systems. attr_accessor :access_token_url # The public API key of your MessageBird account. Required for *messagebird* integrations. attr_accessor :access_key # Smooch will receive all messages sent to this phone number. Required for *messagebird* integrations. attr_accessor :originator # This color will be used in the messenger header and the button or tab in idle state. (Optional) Used for *Web Messenger* integrations. attr_accessor :brand_color # When `true`, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. The default value is `false`. (Optional) Used for *Web Messenger* integrations. attr_accessor :fixed_intro_pane # This color will be used for customer messages, quick replies and actions in the footer. (Optional) Used for *Web Messenger* integrations. attr_accessor :conversation_color # This color will be used for call-to-actions inside your messages. (Optional) Used for *Web Messenger* integrations. attr_accessor :action_color # Choose how the messenger will appear on your website. Must be either button or tab. (Optional) Used for *Web Messenger* integrations. attr_accessor :display_style # With the button style Web Messenger, you have the option of selecting your own button icon. (Optional) Used for *Web Messenger* integrations. attr_accessor :button_icon_url # With the button style Web Messenger, you have the option of specifying its width. (Optional) Used for *Web Messenger* integrations. attr_accessor :button_width # With the button style Web Messenger, you have the option of specifying its height. (Optional) Used for *Web Messenger* integrations. attr_accessor :button_height # Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed (Optional) Used for *Web Messenger* integrations. attr_accessor :integration_order # A custom business name for the Web Messenger. (Optional) Used for *Web Messenger* integrations. attr_accessor :business_name # A custom business icon url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. attr_accessor :business_icon_url # A custom background url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. attr_accessor :background_image_url # A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454 `scheme \"://\" host [ \":\" port ]`, where scheme is `http` or `https`. (Optional) Used for *Web Messenger* integrations. attr_accessor :origin_whitelist # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'type' => :'type', :'page_access_token' => :'pageAccessToken', :'app_id' => :'appId', :'app_secret' => :'appSecret', :'account_sid' => :'accountSid', :'auth_token' => :'authToken', :'base_url' => :'baseUrl', :'hsm_fallback_language' => :'hsmFallbackLanguage', :'phone_number_sid' => :'phoneNumberSid', :'token' => :'token', :'channel_id' => :'channelId', :'channel_secret' => :'channelSecret', :'channel_access_token' => :'channelAccessToken', :'encoding_aes_key' => :'encodingAesKey', :'from_address' => :'fromAddress', :'certificate' => :'certificate', :'password' => :'password', :'username' => :'username', :'auto_update_badge' => :'autoUpdateBadge', :'server_key' => :'serverKey', :'sender_id' => :'senderId', :'tier' => :'tier', :'env_name' => :'envName', :'consumer_key' => :'consumerKey', :'consumer_secret' => :'consumerSecret', :'access_token_key' => :'accessTokenKey', :'access_token_secret' => :'accessTokenSecret', :'access_token_url' => :'accessTokenUrl', :'access_key' => :'accessKey', :'originator' => :'originator', :'brand_color' => :'brandColor', :'fixed_intro_pane' => :'fixedIntroPane', :'conversation_color' => :'conversationColor', :'action_color' => :'actionColor', :'display_style' => :'displayStyle', :'button_icon_url' => :'buttonIconUrl', :'button_width' => :'buttonWidth', :'button_height' => :'buttonHeight', :'integration_order' => :'integrationOrder', :'business_name' => :'businessName', :'business_icon_url' => :'businessIconUrl', :'background_image_url' => :'backgroundImageUrl', :'origin_whitelist' => :'originWhitelist' } end # Attribute type mapping. def self.swagger_types { :'type' => :'String', :'page_access_token' => :'String', :'app_id' => :'String', :'app_secret' => :'String', :'account_sid' => :'String', :'auth_token' => :'String', :'base_url' => :'String', :'hsm_fallback_language' => :'String', :'phone_number_sid' => :'String', :'token' => :'String', :'channel_id' => :'String', :'channel_secret' => :'String', :'channel_access_token' => :'String', :'encoding_aes_key' => :'String', :'from_address' => :'String', :'certificate' => :'String', :'password' => :'String', :'username' => :'String', :'auto_update_badge' => :'BOOLEAN', :'server_key' => :'String', :'sender_id' => :'String', :'tier' => :'String', :'env_name' => :'String', :'consumer_key' => :'String', :'consumer_secret' => :'String', :'access_token_key' => :'String', :'access_token_secret' => :'String', :'access_token_url' => :'String', :'access_key' => :'String', :'originator' => :'String', :'brand_color' => :'String', :'fixed_intro_pane' => :'BOOLEAN', :'conversation_color' => :'String', :'action_color' => :'String', :'display_style' => :'String', :'button_icon_url' => :'String', :'button_width' => :'String', :'button_height' => :'String', :'integration_order' => :'Array', :'business_name' => :'String', :'business_icon_url' => :'String', :'background_image_url' => :'String', :'origin_whitelist' => :'Array' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'type') self.type = attributes[:'type'] end if attributes.has_key?(:'pageAccessToken') self.page_access_token = attributes[:'pageAccessToken'] end if attributes.has_key?(:'appId') self.app_id = attributes[:'appId'] end if attributes.has_key?(:'appSecret') self.app_secret = attributes[:'appSecret'] end if attributes.has_key?(:'accountSid') self.account_sid = attributes[:'accountSid'] end if attributes.has_key?(:'authToken') self.auth_token = attributes[:'authToken'] end if attributes.has_key?(:'baseUrl') self.base_url = attributes[:'baseUrl'] end if attributes.has_key?(:'hsmFallbackLanguage') self.hsm_fallback_language = attributes[:'hsmFallbackLanguage'] end if attributes.has_key?(:'phoneNumberSid') self.phone_number_sid = attributes[:'phoneNumberSid'] end if attributes.has_key?(:'token') self.token = attributes[:'token'] end if attributes.has_key?(:'channelId') self.channel_id = attributes[:'channelId'] end if attributes.has_key?(:'channelSecret') self.channel_secret = attributes[:'channelSecret'] end if attributes.has_key?(:'channelAccessToken') self.channel_access_token = attributes[:'channelAccessToken'] end if attributes.has_key?(:'encodingAesKey') self.encoding_aes_key = attributes[:'encodingAesKey'] end if attributes.has_key?(:'fromAddress') self.from_address = attributes[:'fromAddress'] end if attributes.has_key?(:'certificate') self.certificate = attributes[:'certificate'] end if attributes.has_key?(:'password') self.password = attributes[:'password'] end if attributes.has_key?(:'username') self.username = attributes[:'username'] end if attributes.has_key?(:'autoUpdateBadge') self.auto_update_badge = attributes[:'autoUpdateBadge'] end if attributes.has_key?(:'serverKey') self.server_key = attributes[:'serverKey'] end if attributes.has_key?(:'senderId') self.sender_id = attributes[:'senderId'] end if attributes.has_key?(:'tier') self.tier = attributes[:'tier'] end if attributes.has_key?(:'envName') self.env_name = attributes[:'envName'] end if attributes.has_key?(:'consumerKey') self.consumer_key = attributes[:'consumerKey'] end if attributes.has_key?(:'consumerSecret') self.consumer_secret = attributes[:'consumerSecret'] end if attributes.has_key?(:'accessTokenKey') self.access_token_key = attributes[:'accessTokenKey'] end if attributes.has_key?(:'accessTokenSecret') self.access_token_secret = attributes[:'accessTokenSecret'] end if attributes.has_key?(:'accessTokenUrl') self.access_token_url = attributes[:'accessTokenUrl'] end if attributes.has_key?(:'accessKey') self.access_key = attributes[:'accessKey'] end if attributes.has_key?(:'originator') self.originator = attributes[:'originator'] end if attributes.has_key?(:'brandColor') self.brand_color = attributes[:'brandColor'] end if attributes.has_key?(:'fixedIntroPane') self.fixed_intro_pane = attributes[:'fixedIntroPane'] end if attributes.has_key?(:'conversationColor') self.conversation_color = attributes[:'conversationColor'] end if attributes.has_key?(:'actionColor') self.action_color = attributes[:'actionColor'] end if attributes.has_key?(:'displayStyle') self.display_style = attributes[:'displayStyle'] end if attributes.has_key?(:'buttonIconUrl') self.button_icon_url = attributes[:'buttonIconUrl'] end if attributes.has_key?(:'buttonWidth') self.button_width = attributes[:'buttonWidth'] end if attributes.has_key?(:'buttonHeight') self.button_height = attributes[:'buttonHeight'] end if attributes.has_key?(:'integrationOrder') if (value = attributes[:'integrationOrder']).is_a?(Array) self.integration_order = value end end if attributes.has_key?(:'businessName') self.business_name = attributes[:'businessName'] end if attributes.has_key?(:'businessIconUrl') self.business_icon_url = attributes[:'businessIconUrl'] end if attributes.has_key?(:'backgroundImageUrl') self.background_image_url = attributes[:'backgroundImageUrl'] end if attributes.has_key?(:'originWhitelist') if (value = attributes[:'originWhitelist']).is_a?(Array) self.origin_whitelist = value end end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properies with the reasons def list_invalid_properties invalid_properties = Array.new if @type.nil? invalid_properties.push("invalid value for 'type', type cannot be nil.") end return invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return false if @type.nil? return true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && page_access_token == o.page_access_token && app_id == o.app_id && app_secret == o.app_secret && account_sid == o.account_sid && auth_token == o.auth_token && base_url == o.base_url && hsm_fallback_language == o.hsm_fallback_language && phone_number_sid == o.phone_number_sid && token == o.token && channel_id == o.channel_id && channel_secret == o.channel_secret && channel_access_token == o.channel_access_token && encoding_aes_key == o.encoding_aes_key && from_address == o.from_address && certificate == o.certificate && password == o.password && username == o.username && auto_update_badge == o.auto_update_badge && server_key == o.server_key && sender_id == o.sender_id && tier == o.tier && env_name == o.env_name && consumer_key == o.consumer_key && consumer_secret == o.consumer_secret && access_token_key == o.access_token_key && access_token_secret == o.access_token_secret && access_token_url == o.access_token_url && access_key == o.access_key && originator == o.originator && brand_color == o.brand_color && fixed_intro_pane == o.fixed_intro_pane && conversation_color == o.conversation_color && action_color == o.action_color && display_style == o.display_style && button_icon_url == o.button_icon_url && button_width == o.button_width && button_height == o.button_height && integration_order == o.integration_order && business_name == o.business_name && business_icon_url == o.business_icon_url && background_image_url == o.background_image_url && origin_whitelist == o.origin_whitelist end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [type, page_access_token, app_id, app_secret, account_sid, auth_token, base_url, hsm_fallback_language, phone_number_sid, token, channel_id, channel_secret, channel_access_token, encoding_aes_key, from_address, certificate, password, username, auto_update_badge, server_key, sender_id, tier, env_name, consumer_key, consumer_secret, access_token_key, access_token_secret, access_token_url, access_key, originator, brand_color, fixed_intro_pane, conversation_color, action_color, display_style, button_icon_url, button_width, button_height, integration_order, business_name, business_icon_url, background_image_url, origin_whitelist].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = SmoochApi.const_get(type).new temp_model.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end