lib/twilio-ruby/rest/messaging/v1/service.rb in twilio-ruby-6.0.0.pre.rc.3 vs lib/twilio-ruby/rest/messaging/v1/service.rb in twilio-ruby-6.0.0

- old
+ new

@@ -203,14 +203,14 @@ @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @us_app_to_person_usecases = nil + @alpha_senders = nil @short_codes = nil @us_app_to_person = nil @phone_numbers = nil - @alpha_senders = nil end ## # Delete the ServiceInstance # @return [Boolean] True if delete succeeds, false otherwise def delete @@ -301,19 +301,34 @@ # @return [UsAppToPersonUsecaseList] # @return [UsAppToPersonUsecaseContext] def us_app_to_person_usecases unless @us_app_to_person_usecases @us_app_to_person_usecases = UsAppToPersonUsecaseList.new( - @version, - service_sid: @solution[:sid] - - ) + @version, service_sid: @solution[:sid], messaging_service_sid: @solution[:sid], ) end - @us_app_to_person_usecases end ## + # Access the alpha_senders + # @return [AlphaSenderList] + # @return [AlphaSenderContext] if sid was passed. + def alpha_senders(sid=:unset) + + raise ArgumentError, 'sid cannot be nil' if sid.nil? + + if sid != :unset + return AlphaSenderContext.new(@version, @solution[:sid],sid ) + end + + unless @alpha_senders + @alpha_senders = AlphaSenderList.new( + @version, service_sid: @solution[:sid], messaging_service_sid: @solution[:sid], ) + end + + @alpha_senders + end + ## # Access the short_codes # @return [ShortCodeList] # @return [ShortCodeContext] if sid was passed. def short_codes(sid=:unset) @@ -323,14 +338,11 @@ return ShortCodeContext.new(@version, @solution[:sid],sid ) end unless @short_codes @short_codes = ShortCodeList.new( - @version, - service_sid: @solution[:sid] - - ) + @version, service_sid: @solution[:sid], messaging_service_sid: @solution[:sid], ) end @short_codes end ## @@ -345,14 +357,11 @@ return UsAppToPersonContext.new(@version, @solution[:sid],sid ) end unless @us_app_to_person @us_app_to_person = UsAppToPersonList.new( - @version, - service_sid: @solution[:sid] - - ) + @version, service_sid: @solution[:sid], messaging_service_sid: @solution[:sid], ) end @us_app_to_person end ## @@ -367,41 +376,16 @@ return PhoneNumberContext.new(@version, @solution[:sid],sid ) end unless @phone_numbers @phone_numbers = PhoneNumberList.new( - @version, - service_sid: @solution[:sid] - - ) + @version, service_sid: @solution[:sid], messaging_service_sid: @solution[:sid], ) end @phone_numbers end - ## - # Access the alpha_senders - # @return [AlphaSenderList] - # @return [AlphaSenderContext] if sid was passed. - def alpha_senders(sid=:unset) - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return AlphaSenderContext.new(@version, @solution[:sid],sid ) - end - - unless @alpha_senders - @alpha_senders = AlphaSenderList.new( - @version, - service_sid: @solution[:sid] - - ) - end - - @alpha_senders - end - ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.ServiceContext #{context}>" @@ -717,10 +701,17 @@ def us_app_to_person_usecases context.us_app_to_person_usecases end ## + # Access the alpha_senders + # @return [alpha_senders] alpha_senders + def alpha_senders + context.alpha_senders + end + + ## # Access the short_codes # @return [short_codes] short_codes def short_codes context.short_codes end @@ -735,16 +726,9 @@ ## # Access the phone_numbers # @return [phone_numbers] phone_numbers def phone_numbers context.phone_numbers - end - - ## - # Access the alpha_senders - # @return [alpha_senders] alpha_senders - def alpha_senders - context.alpha_senders end ## # Provide a user friendly representation def to_s