Class: Stripe::StripeClient::RequestLogContext

Inherits:
Object
  • Object
show all
Defined in:
lib/stripe/stripe_client.rb

Overview

RequestLogContext stores information about a request that’s begin made so that we can log certain information. It’s useful because it means that we don’t have to pass around as many parameters.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accountObject

Returns the value of attribute account.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def 
  @account
end

#api_keyObject

Returns the value of attribute api_key.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def api_key
  @api_key
end

#api_versionObject

Returns the value of attribute api_version.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def api_version
  @api_version
end

#authenticatorObject

Returns the value of attribute authenticator.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def authenticator
  @authenticator
end

#bodyObject

Returns the value of attribute body.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def body
  @body
end

#idempotency_keyObject

Returns the value of attribute idempotency_key.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def idempotency_key
  @idempotency_key
end

#methodObject

Returns the value of attribute method.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def method
  @method
end

#pathObject

Returns the value of attribute path.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def path
  @path
end

#queryObject

Returns the value of attribute query.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def query
  @query
end

#request_idObject

Returns the value of attribute request_id.



997
998
999
# File 'lib/stripe/stripe_client.rb', line 997

def request_id
  @request_id
end

Instance Method Details

#dup_from_response_headers(headers) ⇒ Object

The idea with this method is that we might want to update some of context information because a response that we’ve received from the API contains information that’s more authoritative than what we started with for a request. For example, we should trust whatever came back in a ‘Stripe-Version` header beyond what configuration information that we might have had available.



1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/stripe/stripe_client.rb', line 1006

def dup_from_response_headers(headers)
  context = dup
  context. = headers["Stripe-Account"]
  context.api_version = headers["Stripe-Version"]
  context.idempotency_key = headers["Idempotency-Key"]
  context.request_id = headers["Request-Id"]
  context
end