Class: GoogleWallet::Operations::SignObjects
- Inherits:
-
Object
- Object
- GoogleWallet::Operations::SignObjects
- Defined in:
- lib/google_wallet/operations/sign_objects.rb
Constant Summary collapse
- DEFAULT_OBJECTS_TYPE =
'genericObjects'
Instance Attribute Summary collapse
-
#jwt ⇒ Object
readonly
Returns the value of attribute jwt.
-
#objects_type ⇒ Object
readonly
Returns the value of attribute objects_type.
-
#resource_ids ⇒ Object
readonly
Returns the value of attribute resource_ids.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(resources: [], resource_ids: [], objects_type: DEFAULT_OBJECTS_TYPE) ⇒ SignObjects
constructor
A new instance of SignObjects.
Constructor Details
#initialize(resources: [], resource_ids: [], objects_type: DEFAULT_OBJECTS_TYPE) ⇒ SignObjects
Returns a new instance of SignObjects.
11 12 13 14 15 16 17 18 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 11 def initialize(resources: [], resource_ids: [], objects_type: DEFAULT_OBJECTS_TYPE) @resources = resources.kind_of?(Array) ? resources : [resources] @resource_ids = resource_ids.kind_of?(Array) ? resource_ids : [resource_ids] @objects_type = objects_type unless resource_ids.empty? GoogleWallet.logger.info("You didn't provide objects_type, fallback to use default #{DEFAULT_OBJECTS_TYPE}") end end |
Instance Attribute Details
#jwt ⇒ Object (readonly)
Returns the value of attribute jwt.
8 9 10 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 8 def jwt @jwt end |
#objects_type ⇒ Object (readonly)
Returns the value of attribute objects_type.
8 9 10 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 8 def objects_type @objects_type end |
#resource_ids ⇒ Object (readonly)
Returns the value of attribute resource_ids.
8 9 10 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 8 def resource_ids @resource_ids end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
8 9 10 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 8 def resources @resources end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/google_wallet/operations/sign_objects.rb', line 20 def call payload = { iss: GoogleWallet.configuration.json_credentials["client_email"], aud: 'google', typ: 'savetowallet', payload: objects_payload, origins: [] } @jwt = JWT.encode(payload, rsa_private_key, 'RS256') true end |