Class: Subscription
- Inherits:
-
SubscriptionBase
- Object
- Base
- SubscriptionBase
- Subscription
- Defined in:
- lib/rave_ruby/rave_objects/subscription.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #activate_subscription(trans_id) ⇒ Object
- #cancel_subscription(trans_id) ⇒ Object
-
#fetch_subscription(trans_id) ⇒ Object
method to fetch a subscription.
-
#list_all_subscription ⇒ Object
method to list subscriptions.
Methods inherited from SubscriptionBase
#handle_activate_subscription_response, #handle_cancel_subscription_response, #handle_fetch_subscription_response, #handle_list_all_subscription
Methods inherited from Base
#check_passed_parameters, #get_request, #handle_list_bank, #initialize, #post_request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#activate_subscription(trans_id) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rave_ruby/rave_objects/subscription.rb', line 37 def activate_subscription(trans_id) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup # data.merge!({"seckey" => secret_key.dup}) payload = { "seckey" => secret_key, } payload = payload.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::SUBSCRIPTIONS_ENDPOINT}/#{trans_id}/activate?fetch_by_tx=1",payload) return handle_activate_subscription_response(response) end |
#cancel_subscription(trans_id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rave_ruby/rave_objects/subscription.rb', line 24 def cancel_subscription(trans_id) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup payload = { "seckey" => secret_key, } payload = payload.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::SUBSCRIPTIONS_ENDPOINT}/#{trans_id}/cancel?fetch_by_tx=1",payload) return handle_cancel_subscription_response(response) end |
#fetch_subscription(trans_id) ⇒ Object
method to fetch a subscription
16 17 18 19 20 21 22 |
# File 'lib/rave_ruby/rave_objects/subscription.rb', line 16 def fetch_subscription(trans_id) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup response = get_request("#{base_url}#{BASE_ENDPOINTS::SUBSCRIPTIONS_ENDPOINT}/query",{"seckey" => rave_object.secret_key.dup, "transaction_id" => trans_id}) return handle_fetch_subscription_response(response) end |
#list_all_subscription ⇒ Object
method to list subscriptions
8 9 10 11 12 |
# File 'lib/rave_ruby/rave_objects/subscription.rb', line 8 def list_all_subscription base_url = rave_object.base_url response = get_request("#{base_url}#{BASE_ENDPOINTS::SUBSCRIPTIONS_ENDPOINT}/query",{"seckey" => rave_object.secret_key.dup}) return handle_list_all_subscription(response) end |