class Plivo::Base::SecondaryResource
Attributes
Public Class Methods
Source
# File lib/plivo/base/resource.rb, line 161 def initialize(client, options = nil) super configure_secondary_options(options) if options configure_secondary_resource_uri end
Calls superclass method
Plivo::Base::Resource::new
Public Instance Methods
Source
# File lib/plivo/base/resource.rb, line 167 def configure_secondary_options(options) valid_param?(:options, options, Hash, false) @secondary_id = options[:member_id] if options.key?(:member_id) secondary_parse_and_set(options[:resource_json]) if options.key?(:resource_json) end
Source
# File lib/plivo/base/resource.rb, line 181 def configure_secondary_resource_uri to_join = @secondary_id ? [@_client.auth_id, @_name, @id, @_secondary_name, @secondary_id] : [@_client.auth_id, @_name, @id] to_join = ['', 'v1', 'Account'] << to_join to_join << '' @_resource_uri = to_join.join('/') end
Source
# File lib/plivo/base/resource.rb, line 173 def secondary_parse_and_set(resource_json) return unless resource_json valid_param?(:resource_json, resource_json, Hash, true) return unless @_secondary_identifier_string && (resource_json.key? @_secondary_identifier_string) @secondary_id = resource_json[@_secondary_identifier_string] end