Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription update #90

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ Metrics/LineLength:
Style/SymbolArray:
MinSize: 3

Style/FrozenStringLiteralComment:
Enabled: false

Gemspec/RubyVersionGlobalsUsage:
Enabled: false

Metrics/MethodLength:
Max: 15

Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
MinNameLength: 1
AllowNamesEndingInNumbers: false

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ You can find plan API documentation at <https://razorpay.com/docs/subscriptions/
```rb
# Creating a subscription and starting after 24 hours (24 hours = 60 * 60 * 24)
subscription = Razorpay::Subscription.create plan_id: plan.id, customer_id: customer.id, start_at: (Time.now + (60 * 60 * 24)).to_i, total_count: 3

# Update a subscription
Razorpa::Subscription.update 'sub_AbcdXYz', { start_at: (Time.now + (60 * 60 * 24)).to_i, quantity: 5 }
```

You can find subscription API documentation at <https://razorpay.com/docs/subscriptions/api/#subscription>.
Expand Down
4 changes: 2 additions & 2 deletions lib/razorpay/entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def respond_to_missing?(method_name, include_private = false)

# Public: Convert the Entity object to JSON
# Returns the JSON representation of the Entity (as a string)
def to_json(*args)
@attributes.to_json(*args)
def to_json(*_args)
@attributes.to_json
end

# Mutates the entity in accordance with
Expand Down
4 changes: 4 additions & 0 deletions lib/razorpay/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def self.all(options = {})
request.all options
end

def self.update(id, options = {})
request.patch id, options
end

def self.cancel(id, options = {})
request.post "#{id}/cancel", options
end
Expand Down