Class: Twilio::REST::Messaging::V1::ServiceContext::UsAppToPersonInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, messaging_service_sid: nil, sid: nil) ⇒ UsAppToPersonInstance

Initialize the UsAppToPersonInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this UsAppToPerson resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 708

def initialize(version, payload , messaging_service_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'brand_registration_sid' => payload['brand_registration_sid'],
        'messaging_service_sid' => payload['messaging_service_sid'],
        'description' => payload['description'],
        'message_samples' => payload['message_samples'],
        'us_app_to_person_usecase' => payload['us_app_to_person_usecase'],
        'has_embedded_links' => payload['has_embedded_links'],
        'has_embedded_phone' => payload['has_embedded_phone'],
        'subscriber_opt_in' => payload['subscriber_opt_in'],
        'age_gated' => payload['age_gated'],
        'direct_lending' => payload['direct_lending'],
        'campaign_status' => payload['campaign_status'],
        'campaign_id' => payload['campaign_id'],
        'is_externally_registered' => payload['is_externally_registered'],
        'rate_limits' => payload['rate_limits'],
        'message_flow' => payload['message_flow'],
        'opt_in_message' => payload['opt_in_message'],
        'opt_out_message' => payload['opt_out_message'],
        'help_message' => payload['help_message'],
        'opt_in_keywords' => payload['opt_in_keywords'],
        'opt_out_keywords' => payload['opt_out_keywords'],
        'help_keywords' => payload['help_keywords'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'mock' => payload['mock'],
        'errors' => payload['errors'],
        'privacy_policy_url' => payload['privacy_policy_url'],
        'terms_and_conditions_url' => payload['terms_and_conditions_url'],
    }

    # Context
    @instance_context = nil
    @params = { 'messaging_service_sid' => messaging_service_sid  || @properties['messaging_service_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that the Campaign belongs to.

Returns:

  • (String) —

    The SID of the Account that the Campaign belongs to.



770
771
772
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 770

def 
    @properties['account_sid']
end

#age_gated ⇒ Boolean

Returns A boolean that specifies whether campaign is age gated or not.

Returns:

  • (Boolean) —

    A boolean that specifies whether campaign is age gated or not.



824
825
826
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 824

def age_gated
    @properties['age_gated']
end

#brand_registration_sid ⇒ String

Returns The unique string to identify the A2P brand.

Returns:

  • (String) —

    The unique string to identify the A2P brand.



776
777
778
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 776

def brand_registration_sid
    @properties['brand_registration_sid']
end

#campaign_id ⇒ String

Returns The Campaign Registry (TCR) Campaign ID.

Returns:

  • (String) —

    The Campaign Registry (TCR) Campaign ID.



842
843
844
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 842

def campaign_id
    @properties['campaign_id']
end

#campaign_status ⇒ String

Returns Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.

Returns:

  • (String) —

    Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.



836
837
838
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 836

def campaign_status
    @properties['campaign_status']
end

#context ⇒ UsAppToPersonContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



755
756
757
758
759
760
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 755

def context
    unless @instance_context
        @instance_context = UsAppToPersonContext.new(@version , @params['messaging_service_sid'], @params['sid'])
    end
    @instance_context
end

#date_created ⇒ Time

Returns The date and time in GMT when the resource was created specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the resource was created specified in ISO 8601 format.



902
903
904
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 902

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date and time in GMT when the resource was last updated specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the resource was last updated specified in ISO 8601 format.



908
909
910
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 908

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the UsAppToPersonInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



945
946
947
948
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 945

def delete

    context.delete
end

#description ⇒ String

Returns A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.

Returns:

  • (String) —

    A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.



788
789
790
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 788

def description
    @properties['description']
end

#direct_lending ⇒ Boolean

Returns A boolean that specifies whether campaign allows direct lending or not.

Returns:

  • (Boolean) —

    A boolean that specifies whether campaign allows direct lending or not.



830
831
832
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 830

def direct_lending
    @properties['direct_lending']
end

#errors ⇒ Array<Hash>

Returns Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.

Returns:

  • (Array<Hash>) —

    Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.



926
927
928
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 926

def errors
    @properties['errors']
end

#fetch(x_twilio_api_version: :unset) ⇒ UsAppToPersonInstance

Fetch the UsAppToPersonInstance

Parameters:

  • x_twilio_api_version (String) (defaults to: :unset) —

    The version of the Messaging API to use for this request

Returns:



954
955
956
957
958
959
960
961
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 954

def fetch(
  x_twilio_api_version: :unset
)

    context.fetch(
        x_twilio_api_version: x_twilio_api_version, 
    )
end

Returns Indicate that this SMS campaign will send messages that contain links.

Returns:

  • (Boolean) —

    Indicate that this SMS campaign will send messages that contain links.



806
807
808
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 806

def has_embedded_links
    @properties['has_embedded_links']
end

#has_embedded_phone ⇒ Boolean

Returns Indicates that this SMS campaign will send messages that contain phone numbers.

Returns:

  • (Boolean) —

    Indicates that this SMS campaign will send messages that contain phone numbers.



812
813
814
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 812

def has_embedded_phone
    @properties['has_embedded_phone']
end

#help_keywords ⇒ Array<String>

Returns End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>) —

    End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.



896
897
898
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 896

def help_keywords
    @properties['help_keywords']
end

#help_message ⇒ String

Returns When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.

Returns:

  • (String) —

    When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.



878
879
880
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 878

def help_message
    @properties['help_message']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



1012
1013
1014
1015
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 1012

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
end

#is_externally_registered ⇒ Boolean

Returns Indicates whether the campaign was registered externally or not.

Returns:

  • (Boolean) —

    Indicates whether the campaign was registered externally or not.



848
849
850
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 848

def is_externally_registered
    @properties['is_externally_registered']
end

#message_flow ⇒ String

Returns Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.

Returns:

  • (String) —

    Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.



860
861
862
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 860

def message_flow
    @properties['message_flow']
end

#message_samples ⇒ Array<String>

Returns An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.

Returns:

  • (Array<String>) —

    An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.



794
795
796
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 794

def message_samples
    @properties['message_samples']
end

#messaging_service_sid ⇒ String

Returns The SID of the Messaging Service that the resource is associated with.

Returns:

  • (String) —

    The SID of the Messaging Service that the resource is associated with.



782
783
784
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 782

def messaging_service_sid
    @properties['messaging_service_sid']
end

#mock ⇒ Boolean

Returns A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.

Returns:

  • (Boolean) —

    A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.



920
921
922
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 920

def mock
    @properties['mock']
end

#opt_in_keywords ⇒ Array<String>

Returns If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>) —

    If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.



884
885
886
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 884

def opt_in_keywords
    @properties['opt_in_keywords']
end

#opt_in_message ⇒ String

Returns If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.

Returns:

  • (String) —

    If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.



866
867
868
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 866

def opt_in_message
    @properties['opt_in_message']
end

#opt_out_keywords ⇒ Array<String>

Returns End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>) —

    End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.



890
891
892
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 890

def opt_out_keywords
    @properties['opt_out_keywords']
end

#opt_out_message ⇒ String

Returns Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.

Returns:

  • (String) —

    Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.



872
873
874
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 872

def opt_out_message
    @properties['opt_out_message']
end

#privacy_policy_url ⇒ String

Returns The URL of the privacy policy for the campaign.

Returns:

  • (String) —

    The URL of the privacy policy for the campaign.



932
933
934
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 932

def privacy_policy_url
    @properties['privacy_policy_url']
end

#rate_limits ⇒ Hash

Returns Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.

Returns:

  • (Hash) —

    Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.



854
855
856
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 854

def rate_limits
    @properties['rate_limits']
end

#sid ⇒ String

Returns The unique string that identifies a US A2P Compliance resource QE2c6890da8086d771620e9b13fadeba0b.

Returns:

  • (String) —

    The unique string that identifies a US A2P Compliance resource QE2c6890da8086d771620e9b13fadeba0b.



764
765
766
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 764

def sid
    @properties['sid']
end

#subscriber_opt_in ⇒ Boolean

Returns A boolean that specifies whether campaign has Subscriber Optin or not.

Returns:

  • (Boolean) —

    A boolean that specifies whether campaign has Subscriber Optin or not.



818
819
820
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 818

def subscriber_opt_in
    @properties['subscriber_opt_in']
end

#terms_and_conditions_url ⇒ String

Returns The URL of the terms and conditions for the campaign.

Returns:

  • (String) —

    The URL of the terms and conditions for the campaign.



938
939
940
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 938

def terms_and_conditions_url
    @properties['terms_and_conditions_url']
end

#to_s ⇒ Object

Provide a user friendly representation



1005
1006
1007
1008
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 1005

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
end

#update(has_embedded_links: nil, has_embedded_phone: nil, message_samples: nil, message_flow: nil, description: nil, age_gated: nil, direct_lending: nil, privacy_policy_url: :unset, terms_and_conditions_url: :unset, x_twilio_api_version: :unset) ⇒ UsAppToPersonInstance

Update the UsAppToPersonInstance

Parameters:

  • has_embedded_links (Boolean) (defaults to: nil) —

    Indicates that this SMS campaign will send messages that contain links.

  • has_embedded_phone (Boolean) (defaults to: nil) —

    Indicates that this SMS campaign will send messages that contain phone numbers.

  • message_samples (Array[String]) (defaults to: nil) —

    An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.

  • message_flow (String) (defaults to: nil) —

    Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.

  • description (String) (defaults to: nil) —

    A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.

  • age_gated (Boolean) (defaults to: nil) —

    A boolean that specifies whether campaign requires age gate for federally legal content.

  • direct_lending (Boolean) (defaults to: nil) —

    A boolean that specifies whether campaign allows direct lending or not.

  • privacy_policy_url (String) (defaults to: :unset) —

    The URL of the privacy policy for the campaign.

  • terms_and_conditions_url (String) (defaults to: :unset) —

    The URL of the terms and conditions for the campaign.

  • x_twilio_api_version (String) (defaults to: :unset) —

    The version of the Messaging API to use for this request

Returns:



976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 976

def update(
  has_embedded_links: nil, 
  has_embedded_phone: nil, 
  message_samples: nil, 
  message_flow: nil, 
  description: nil, 
  age_gated: nil, 
  direct_lending: nil, 
  privacy_policy_url: :unset, 
  terms_and_conditions_url: :unset, 
  x_twilio_api_version: :unset
)

    context.update(
        has_embedded_links: has_embedded_links, 
        has_embedded_phone: has_embedded_phone, 
        message_samples: message_samples, 
        message_flow: message_flow, 
        description: description, 
        age_gated: age_gated, 
        direct_lending: direct_lending, 
        privacy_policy_url: privacy_policy_url, 
        terms_and_conditions_url: terms_and_conditions_url, 
        x_twilio_api_version: x_twilio_api_version, 
    )
end

#url ⇒ String

Returns The absolute URL of the US App to Person resource.

Returns:

  • (String) —

    The absolute URL of the US App to Person resource.



914
915
916
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 914

def url
    @properties['url']
end

#us_app_to_person_usecase ⇒ String

Returns A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.

Returns:

  • (String) —

    A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.



800
801
802
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 800

def us_app_to_person_usecase
    @properties['us_app_to_person_usecase']
end