Class: Twilio::REST::Messaging::V3::MessageCostEstimateList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ MessageCostEstimateList

Initialize the MessageCostEstimateList

Parameters:

  • version (Version) —

    Version that contains the resource



26
27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb', line 26

def initialize(version)
    super(version)
    
    # Path Solution
    @solution = {  }
    @uri = "/MessageCostEstimate"
    
end

Instance Method Details

#fetch(country: nil, lookback_window: nil) ⇒ MessageCostEstimateInstance

Fetch the MessageCostEstimateInstance

Parameters:

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

    The ISO-3166-1 alpha-2 country code to estimate for. Exactly one country is accepted.

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

    The historical lookback window used to compute the estimate.

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb', line 39

def fetch(
  country: nil, 
  lookback_window: nil
)

    params = Twilio::Values.of({
        'country' => country,
        'lookbackWindow' => lookback_window,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    MessageCostEstimateInstance.new(
        @version,
        payload,
    )
end

#fetch_with_metadata(country: nil, lookback_window: nil) ⇒ MessageCostEstimateInstance

Fetch the MessageCostEstimateInstanceMetadata

Parameters:

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

    The ISO-3166-1 alpha-2 country code to estimate for. Exactly one country is accepted.

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

    The historical lookback window used to compute the estimate.

Returns:



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
91
92
# File 'lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb', line 66

def (
  country: nil, 
  lookback_window: nil
)

    params = Twilio::Values.of({
        'country' => country,
        'lookbackWindow' => lookback_window,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, params: params, headers: headers)
    message_cost_estimate_instance = MessageCostEstimateInstance.new(
        @version,
        response.body,
    )
    MessageCostEstimateInstanceMetadata.new(
        @version,
        message_cost_estimate_instance,
        response.headers,
        response.status_code
    )
end

#to_s ⇒ Object

Provide a user friendly representation



98
99
100
# File 'lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb', line 98

def to_s
    '#<Twilio.Messaging.V3.MessageCostEstimateList>'
end