-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from ostdotcom/develop
Redemptions API.
- Loading branch information
Showing
12 changed files
with
275 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.2 | ||
2.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module OSTSdk | ||
|
||
module Saas | ||
|
||
class RedeemableSkus < OSTSdk::Saas::Base | ||
|
||
# Initialize | ||
# | ||
# Arguments: | ||
# api_base_url: (String) | ||
# api_key: (String) | ||
# api_secret: (String) | ||
# api_spec: (Boolean) | ||
# config: (Hash) | ||
# | ||
def initialize(params) | ||
super | ||
@url_prefix = '/redeemable-skus' | ||
end | ||
|
||
# Get redeemable sku detail | ||
# | ||
# Returns: | ||
# response: (Hash) | ||
# | ||
def get(params = {}) | ||
http_helper.send_get_request("#{@url_prefix}/#{get_redeemable_sku_id!(params)}", params) | ||
end | ||
|
||
# List redeemable sku details | ||
# | ||
# Returns: | ||
# response: (Hash) | ||
# | ||
def get_list(params = {}) | ||
http_helper.send_get_request("#{@url_prefix}", params) | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module OSTSdk | ||
|
||
module Saas | ||
|
||
class Redemptions < OSTSdk::Saas::Base | ||
|
||
# Initialize | ||
# | ||
# Arguments: | ||
# api_base_url: (String) | ||
# api_key: (String) | ||
# api_secret: (String) | ||
# api_spec: (Boolean) | ||
# config: (Hash) | ||
# | ||
def initialize(params) | ||
super | ||
@url_prefix = '/users' | ||
@url_suffix = '/redemptions' | ||
end | ||
|
||
# Get redemption detail | ||
# | ||
# Returns: | ||
# response: (Hash) | ||
# | ||
def get(params = {}) | ||
http_helper.send_get_request("#{@url_prefix}/#{get_user_id!(params)}#{@url_suffix}/#{get_redemption_id!(params)}", params) | ||
end | ||
|
||
# List redemptions of a user | ||
# | ||
# Returns: | ||
# response: (Hash) | ||
# | ||
def get_list(params = {}) | ||
http_helper.send_get_request("#{@url_prefix}/#{get_user_id!(params)}#{@url_suffix}", params) | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require_relative "../../../lib/ost-sdk-ruby/util" | ||
require_relative "../../../lib/ost-sdk-ruby/saas" | ||
require "test/unit" | ||
require_relative "../../../lib/config" | ||
|
||
class RedeemableSkusTest < Test::Unit::TestCase | ||
|
||
def redeemable_skus_service | ||
@redeemable_skus_service ||= Config::OST_SDK.services.redeemable_skus | ||
end | ||
|
||
def test_redeemable_skus_get | ||
result = redeemable_skus_service.get(redeemable_sku_id: Config::OST_KIT_REDEEMABLE_SKU_ID) | ||
puts "result=>#{result}" unless result["success"] | ||
assert_equal(result["success"], true) | ||
end | ||
|
||
def test_redeemable_skus_get_list | ||
result = redeemable_skus_service.get_list() | ||
puts "result=>#{result}" unless result["success"] | ||
assert_equal(result["success"], true) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require_relative "../../../lib/ost-sdk-ruby/util" | ||
require_relative "../../../lib/ost-sdk-ruby/saas" | ||
require "test/unit" | ||
require_relative "../../../lib/config" | ||
|
||
class RedemptionsTest < Test::Unit::TestCase | ||
|
||
def redemptions_service | ||
@redemptions_service ||= Config::OST_SDK.services.redemptions | ||
end | ||
|
||
def test_redemptions_get | ||
result = redemptions_service.get(user_id: Config::OST_KIT_USER_ID, redemption_id: Config::OST_KIT_REDEMPTION_ID) | ||
puts "result=>#{result}" unless result["success"] | ||
assert_equal(result["success"], true ) | ||
end | ||
|
||
def test_redemptions_get_list | ||
result = redemptions_service.get_list(user_id: Config::OST_KIT_USER_ID) | ||
puts "result=>#{result}" unless result["success"] | ||
assert_equal(result["success"], true ) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module OSTSdk | ||
|
||
VERSION = "2.2.2" | ||
VERSION = "2.2.3" | ||
|
||
end |