Class: Naver::Searchad::Api::Auth::CustomerAccountCredentials
- Inherits:
-
Object
- Object
- Naver::Searchad::Api::Auth::CustomerAccountCredentials
- Defined in:
- lib/naver/searchad/api/auth.rb
Constant Summary collapse
- TIMESTAMP_HEADER =
'X-Timestamp'.freeze
- API_KEY_HEADER =
'X-API-KEY'.freeze
- CUSTOMER_HEADER =
'X-Customer'.freeze
- SIGNATURE_HEADER =
'X-Signature'.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
Instance Method Summary collapse
- #apply(hash, request_uri, method) ⇒ Object
-
#initialize(api_key, api_secret, customer_id) ⇒ CustomerAccountCredentials
constructor
A new instance of CustomerAccountCredentials.
Constructor Details
#initialize(api_key, api_secret, customer_id) ⇒ CustomerAccountCredentials
Returns a new instance of CustomerAccountCredentials.
18 19 20 21 22 |
# File 'lib/naver/searchad/api/auth.rb', line 18 def initialize(api_key, api_secret, customer_id) @api_key = api_key @api_secret = api_secret @customer_id = customer_id end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
14 15 16 |
# File 'lib/naver/searchad/api/auth.rb', line 14 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
15 16 17 |
# File 'lib/naver/searchad/api/auth.rb', line 15 def api_secret @api_secret end |
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
16 17 18 |
# File 'lib/naver/searchad/api/auth.rb', line 16 def customer_id @customer_id end |
Instance Method Details
#apply(hash, request_uri, method) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/naver/searchad/api/auth.rb', line 24 def apply(hash, request_uri, method) = Time.now.to_i hash[TIMESTAMP_HEADER] = hash[API_KEY_HEADER] = api_key hash[CUSTOMER_HEADER] = customer_id hash[SIGNATURE_HEADER] = generate_signature(api_secret, request_uri, method, ) end |