Class: Twilio::REST::Numbers::V2::BundleCloneContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, bundle_sid) ⇒ BundleCloneContext

Initialize the BundleCloneContext

Parameters:

  • Version that contains the resource

  • The unique string that identifies the Bundle to be cloned.



50
51
52
53
54
55
56
57
58
59
# File 'lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb', line 50

def initialize(version, bundle_sid)
    super(version)
    

    # Path Solution
    @solution = { bundle_sid: bundle_sid,  }
    @uri = "/RegulatoryCompliance/Bundles/#{@solution[:bundle_sid]}/Clones"

    
end

Instance Method Details

#create(target_account_sid: nil, move_to_draft: :unset, friendly_name: :unset) ⇒ BundleCloneInstance

Create the BundleCloneInstance

Parameters:

  • (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned.

  • (defaults to: :unset)

    If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved

  • (defaults to: :unset)

    The string that you assigned to describe the cloned bundle.

Returns:

  • Created BundleCloneInstance



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb', line 66

def create(
    target_account_sid: nil, 
    move_to_draft: :unset, 
    friendly_name: :unset
)

    data = Twilio::Values.of({
        'TargetAccountSid' => ,
        'MoveToDraft' => move_to_draft,
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    BundleCloneInstance.new(
        @version,
        payload,
        bundle_sid: @solution[:bundle_sid],
    )
end

#create_with_metadata(target_account_sid: nil, move_to_draft: :unset, friendly_name: :unset) ⇒ BundleCloneInstance

Create the BundleCloneInstanceMetadata

Parameters:

  • (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned.

  • (defaults to: :unset)

    If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved

  • (defaults to: :unset)

    The string that you assigned to describe the cloned bundle.

Returns:

  • Created BundleCloneInstance



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb', line 98

def (
  target_account_sid: nil, 
  move_to_draft: :unset, 
  friendly_name: :unset
)

    data = Twilio::Values.of({
        'TargetAccountSid' => ,
        'MoveToDraft' => move_to_draft,
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    bundle_clone_instance = BundleCloneInstance.new(
        @version,
        response.body,
        bundle_sid: @solution[:bundle_sid],
    )
    .new(
        @version,
        bundle_clone_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



140
141
142
143
# File 'lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb', line 140

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Numbers.V2.BundleCloneContext #{context}>"
end

#to_sObject

Provide a user friendly representation



133
134
135
136
# File 'lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb', line 133

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Numbers.V2.BundleCloneContext #{context}>"
end