Module: MangoApi::Cards
- Extended by:
- UriProvider
- Defined in:
- lib/mangopay/api/service/cards.rb
Overview
Provides API method delegates concerning the Card
entity
Class Method Summary collapse
-
.complete_registration(id, registration_data) ⇒ CardRegistration
Allows completion of a card registration with the registration data received from the Tokenization Server.
-
.create_registration(card_registration, id_key = nil) ⇒ CardRegistration
Creates a new card registration entity.
-
.deactivate(id) ⇒ Card
Deactivates the card entity specified by an id.
-
.get(id) ⇒ Card
Retrieves a card entity.
-
.get_registration(id) ⇒ CardRegistration
Retrieves a card registration entity.
-
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of a user’s card entities.
-
.validate(id) ⇒ Card
Validates the card entity specified by an id.
-
.with_fingerprint(fingerprint) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of card entities corresponding to a certain fingerprint.
Methods included from UriProvider
Class Method Details
.complete_registration(id, registration_data) ⇒ CardRegistration
Allows completion of a card registration with the registration data received from the Tokenization Server.
Tokenization Server object
40 41 42 43 44 45 |
# File 'lib/mangopay/api/service/cards.rb', line 40 def complete_registration(id, registration_data) uri = provide_uri(:complete_card_registration, id) request = CompleteRegistrationRequest.new(registration_data) response = HttpClient.put(uri, request) parse_registration response end |
.create_registration(card_registration, id_key = nil) ⇒ CardRegistration
Creates a new card registration entity.
CardRegistration
properties:
-
Required
-
user_id
-
currency
-
-
Optional
-
tag
-
card_type
-
card registration to be created object
27 28 29 30 31 |
# File 'lib/mangopay/api/service/cards.rb', line 27 def create_registration(card_registration, id_key = nil) uri = provide_uri(:create_card_registration) response = HttpClient.post(uri, card_registration, id_key) parse_registration response end |
.deactivate(id) ⇒ Card
Deactivates the card entity specified by an id.
114 115 116 117 118 |
# File 'lib/mangopay/api/service/cards.rb', line 114 def deactivate(id) uri = provide_uri(:deactivate_card, id) response = HttpClient.put(uri, DeactivationRequest.new) parse_card response end |
.get(id) ⇒ Card
Retrieves a card entity.
61 62 63 64 65 |
# File 'lib/mangopay/api/service/cards.rb', line 61 def get(id) uri = provide_uri(:get_card, id) response = HttpClient.get(uri) parse_card response end |
.get_registration(id) ⇒ CardRegistration
Retrieves a card registration entity.
51 52 53 54 55 |
# File 'lib/mangopay/api/service/cards.rb', line 51 def get_registration(id) uri = provide_uri(:get_card_registration, id) response = HttpClient.get(uri) parse_registration response end |
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of a user’s card entities. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
to provided filters
81 82 83 84 85 86 87 |
# File 'lib/mangopay/api/service/cards.rb', line 81 def of_user(id) uri = provide_uri(:get_users_cards, id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_cards results end |
.validate(id) ⇒ Card
Validates the card entity specified by an id.
124 125 126 127 128 |
# File 'lib/mangopay/api/service/cards.rb', line 124 def validate(id) uri = provide_uri(:card_validate, id) response = HttpClient.post(uri, nil) parse_card response end |
.with_fingerprint(fingerprint) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of card entities corresponding to a certain fingerprint. The Fingerprint is a unique hash key uniquely generated per 16-digit card number.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
which to search for to provided filters
102 103 104 105 106 107 108 |
# File 'lib/mangopay/api/service/cards.rb', line 102 def with_fingerprint(fingerprint) uri = provide_uri(:get_cards_by_fingerprint, fingerprint) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_cards results end |