From 944ea912ca964b8bcc90161a77aeb86697b985ef Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 8 Feb 2024 17:00:26 -0500 Subject: [PATCH 1/4] renamed --- README.md | 32 ++-- flipgive_sdk.gemspec | 4 +- lib/flipgive_sdk.rb | 2 +- .../{shop_cloud.rb => rewards.rb} | 18 +-- spec/flipgive_sdk/rewards_spec.rb | 147 ++++++++++++++++++ spec/flipgive_sdk/shop_cloud_spec.rb | 147 ------------------ spec/flipgive_sdk_spec.rb | 4 +- spec/spec_helper.rb | 2 +- 8 files changed, 178 insertions(+), 178 deletions(-) rename lib/flipgive_sdk/{shop_cloud.rb => rewards.rb} (91%) create mode 100644 spec/flipgive_sdk/rewards_spec.rb delete mode 100644 spec/flipgive_sdk/shop_cloud_spec.rb diff --git a/README.md b/README.md index 24b948f..b0114dc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # FlipgiveSDK -## Shop Cloud +## Rewards -Shop Cloud _(The Shop)_ is [FlipGive's](https://www.flipgive.com) drop-in cashback store. If you would like to know more please visit www.flipgive.com/cloud or contact us at partners@flipgive.com. +Rewards is [FlipGive's](https://www.flipgive.com) drop-in cashback program. If you would like to know more please contact us at partners@flipgive.com. ### Links of Interest @@ -11,7 +11,7 @@ Shop Cloud _(The Shop)_ is [FlipGive's](https://www.flipgive.com) drop-in cashba ### Installation -To begin using `FlipGiveSDK::ShopCloud`, you should have obtained an `ID` and `Secret` pair from FlipGive, store these securely so that they are accessible in your application (env variables, rails credentials, etc). We'll be using env variables in our example below. If you haven't received credentials, please contact us at partners@flipgive.com. +To begin using `FlipGiveSDK::Rewards`, you should have obtained an `ID` and `Secret` pair from FlipGive, store these securely so that they are accessible in your application (env variables, rails credentials, etc). We'll be using env variables in our example below. If you haven't received credentials, please contact us at partners@flipgive.com. Add the gem to your Gemfile: @@ -19,21 +19,21 @@ Add the gem to your Gemfile: gem 'flipgive_sdk', git: "https://github.com/BetterTheWorld/FlipGiveSDK_Ruby.git" ``` -After you have installed the gem include the code below to initialize the ShopCloud: +After you have installed the gem include the code below to initialize the Rewards: ```ruby -FlipgiveSDK::ShopCloud.flip(ENV['shop_cloud_id'], ENV['shop_cloud_secret']) +FlipgiveSDK::Rewards.flip(ENV['rewards_id'], ENV['rewards_secret']) ``` -We recommend using its own initializer file `myapp/config/initializers/shop_cloud.rb`. +We recommend using its own initializer file `myapp/config/initializers/rewards.rb`. -ShopCloud is now ready to use. +Rewards is now ready to use. ### Usage -The main purpose of `FlipgiveSDK::ShopCloud` is to generate Tokens to gain access to FlipGive's Shop Cloud API. There are 6 methods on the gem's public API. +The main purpose of `FlipgiveSDK::Rewards` is to generate Tokens to gain access to FlipGive's Rewards API. There are 6 methods on the gem's public API. #### :flip -This method is used to initialize the SDK, as described on the setup section of this document. It takes 2 arguments, the `shop_cloud_id` and the `shop_cloud_Secret`. +This method is used to initialize the SDK, as described on the setup section of this document. It takes 2 arguments, the `rewards_id` and the `rewards_secret`. #### :read_token This method is used to decode a token that has been generated with your credentials. It takes a single string as an argument and, if able to decode the token, it will return a hash. @@ -41,7 +41,7 @@ This method is used to decode a token that has been generated with your credenti ```ruby token = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..demoToken.g8PZPWb1KDFcAkTsufZq0w@A2DE537C" -FlipgiveSDK::ShopCloud.read_token(token) +FlipgiveSDK::Rewards.read_token(token) => { user_data: { id: 1, name: 'Emmett Brown', email: 'ebrown@time.ca', country: 'USA' } } ``` @@ -56,7 +56,7 @@ payload = { organization_data: organization_data } -FlipgiveSDK::ShopCloud.identified_token(payload) +FlipgiveSDK::Rewards.identified_token(payload) => "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..demoToken.g8PZPWb1KDFcAkTsufZq0w@A2DE537C" ``` @@ -158,15 +158,15 @@ payload = { user_data: user_data } -FlipgiveSDK::ShopCloud.valid_identified?(payload) +FlipgiveSDK::Rewards.valid_identified?(payload) => true ``` #### :partner_token -This method is used to generate a token that can **only** be used by the Shop Cloud partner (that's you) to access reports and other API endpoints. It is only valid for an hour. +This method is used to generate a token that can **only** be used by the Rewards partner (that's you) to access reports and other API endpoints. It is only valid for an hour. ```ruby -FlipgiveSDK::ShopCloud.partner_token +FlipgiveSDK::Rewards.partner_token => "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..demoToken.h9QXQEn2LFGVSlTdiGXW1e@A2DE537C" ``` @@ -180,11 +180,11 @@ payload = { user_data: user_data } -FlipgiveSDK::ShopCloud.valid_identified?(payload) +FlipgiveSDK::Rewards.valid_identified?(payload) # FlipgiveSDK::Error (Invalid payload.) -FlipgiveSDK::ShopCloud.errors +FlipgiveSDK::Rewards.errors => [{:user_data=>"Country must be one of: 'CAN, USA'."}] ``` diff --git a/flipgive_sdk.gemspec b/flipgive_sdk.gemspec index 6a91233..61e0217 100644 --- a/flipgive_sdk.gemspec +++ b/flipgive_sdk.gemspec @@ -8,8 +8,8 @@ Gem::Specification.new do |spec| spec.authors = ["Alejandro"] spec.email = ["alosada@flipgive.com"] - spec.summary = "FlipGive's Shop Cloud Ruby SDK." - spec.description = "FlipGive's Shop Cloud Ruby SDK." + spec.summary = "FlipGive's Ruby SDK." + spec.description = "FlipGive's Ruby SDK." spec.homepage = "https://github.com/BetterTheWorld/FlipGiveSDK_Ruby" spec.required_ruby_version = ">= 2.6.0" diff --git a/lib/flipgive_sdk.rb b/lib/flipgive_sdk.rb index a98ad7d..68f1838 100644 --- a/lib/flipgive_sdk.rb +++ b/lib/flipgive_sdk.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_relative "flipgive_sdk/version" -require_relative "flipgive_sdk/shop_cloud" +require_relative "flipgive_sdk/rewards" module FlipgiveSDK class Error < StandardError; end diff --git a/lib/flipgive_sdk/shop_cloud.rb b/lib/flipgive_sdk/rewards.rb similarity index 91% rename from lib/flipgive_sdk/shop_cloud.rb rename to lib/flipgive_sdk/rewards.rb index e975824..d3a0d66 100644 --- a/lib/flipgive_sdk/shop_cloud.rb +++ b/lib/flipgive_sdk/rewards.rb @@ -1,13 +1,13 @@ require "jwe" # class to handle shop cloud tokens -class FlipgiveSDK::ShopCloud +class FlipgiveSDK::Rewards COUNTRIES = %w[CAN USA].freeze PARTNER_TOKEN_TTL = 3600 # SECONDS class << self - def flip(cloud_shop_id, secret) - @instance = new(cloud_shop_id, secret) + def flip(id, secret) + @instance = new(id, secret) :initialized end @@ -32,15 +32,15 @@ def errors end end - def initialize(cloud_shop_id, secret) - @cloud_shop_id = cloud_shop_id + def initialize(id, secret) + @id = id @secret = secret.gsub("sk_", nil.to_s) @errors = [] end def read_token(token) encrypted_string, shop_id = token.split("@") - raise invalid_token_error if shop_id != cloud_shop_id + raise invalid_token_error if shop_id != id json = JWE.decrypt(encrypted_string, secret) JSON.parse(json) @@ -50,7 +50,7 @@ def identified_token(payload) raise validation_error unless valid_identified?(payload) token = JWE.encrypt(payload.to_json, secret, alg: "dir") - [token, cloud_shop_id].join("@") + [token, id].join("@") end def valid_identified?(payload) @@ -71,14 +71,14 @@ def valid_identified?(payload) def partner_token payload = { type: "partner", expires: partner_token_expiration } token = JWE.encrypt(payload.to_json, secret, alg: "dir") - [token, cloud_shop_id].join("@") + [token, id].join("@") end attr_reader :errors private - attr_reader :secret, :cloud_shop_id + attr_reader :secret, :id def invalid_token_error FlipgiveSDK::Error.new("Invalid Token.") diff --git a/spec/flipgive_sdk/rewards_spec.rb b/spec/flipgive_sdk/rewards_spec.rb new file mode 100644 index 0000000..43abbfd --- /dev/null +++ b/spec/flipgive_sdk/rewards_spec.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +require "securerandom" +# verysecrettoken57e6323c7c74bba0e9fd4d702aeea756c0901e3a6b453671a + +RSpec.describe FlipgiveSDK::Rewards do + before(:all) do + FlipgiveSDK::Rewards.flip("BB126923", "sk_61c394cf3346077b") + end + + let(:secret) { "61c394cf3346077b" } + let(:id) { "BB126923" } + + let(:user_data) { RewardsHelper.person_data } + let(:campaign_data) { RewardsHelper.campaign_data } + let(:group_data) { RewardsHelper.group_data } + let(:organization_data) { RewardsHelper.organization_data } + + let(:payload) do + { + "user_data" => user_data, + "campaign_data" => campaign_data + } + end + + context "#Rewards" do + it "expects Rewards to exist" do + expect(FlipgiveSDK::Rewards).not_to be nil + end + end + context "#initialize" do + it "expects secret and partner id" do + fg_shop_cloud = FlipgiveSDK::Rewards.new("BB126923", "sk_61c394cf3346077b") + expect(fg_shop_cloud).to receive(:secret).and_return(secret) + expect(fg_shop_cloud).to receive(:id).and_return(id) + allow(fg_shop_cloud).to receive(:valid_identified?).and_return true + + fg_shop_cloud.identified_token({ foo: "bar" }) + end + end + + context "#token" do + it "expects token to be generated and append id" do + token = FlipgiveSDK::Rewards.identified_token(payload) + regexp = Regexp.new("#{id}\\z") + + expect(token).to be_kind_of(String) + expect(token).to match(regexp) + end + + it "expects invalid params error" do + payload = "foobar" + + expect { FlipgiveSDK::Rewards.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) + end + + it "expects invalid user_data_errors" do + payload["user_data"] = {} + payload["campaign_data"] = nil + + expect { FlipgiveSDK::Rewards.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) + expect(FlipgiveSDK::Rewards.errors).not_to be_empty + expect(FlipgiveSDK::Rewards.errors.count).to eq(5) + expect(FlipgiveSDK::Rewards.errors[0][:payload]).to eq("At least must contain user_data or campaign_data.") + expect(FlipgiveSDK::Rewards.errors[1][:user_data]).to eq("id missing.") + expect(FlipgiveSDK::Rewards.errors[2][:user_data]).to eq("name missing.") + expect(FlipgiveSDK::Rewards.errors[3][:user_data]).to eq("email missing.") + expect(FlipgiveSDK::Rewards.errors[4][:user_data]).to eq("country must be one of: 'CAN, USA'.") + end + + it "expects invalid campaign_data" do + payload["user_data"] = nil + payload["campaign_data"] = {} + + expect { FlipgiveSDK::Rewards.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) + expect(FlipgiveSDK::Rewards.errors).not_to be_empty + expect(FlipgiveSDK::Rewards.errors.count).to eq(9) + expect(FlipgiveSDK::Rewards.errors[0][:payload]).to eq("At least must contain user_data or campaign_data.") + expect(FlipgiveSDK::Rewards.errors[1][:campaign_data]).to eq("id missing.") + expect(FlipgiveSDK::Rewards.errors[2][:campaign_data]).to eq("name missing.") + expect(FlipgiveSDK::Rewards.errors[3][:campaign_data]).to eq("category missing.") + expect(FlipgiveSDK::Rewards.errors[4][:campaign_data]).to eq("country must be one of: 'CAN, USA'.") + expect(FlipgiveSDK::Rewards.errors[5][:campaign_admin_data]).to eq("id missing.") + expect(FlipgiveSDK::Rewards.errors[6][:campaign_admin_data]).to eq("name missing.") + expect(FlipgiveSDK::Rewards.errors[7][:campaign_admin_data]).to eq("email missing.") + expect(FlipgiveSDK::Rewards.errors[8][:campaign_admin_data]).to eq("country must be one of: 'CAN, USA'.") + end + + it "expects token to be successfully decoded" do + token = FlipgiveSDK::Rewards.identified_token(payload) + data = FlipgiveSDK::Rewards.read_token(token) + expect(data).to eq(payload) + end + + it "Partner token has partner_token type" do + token = FlipgiveSDK::Rewards.partner_token + data = FlipgiveSDK::Rewards.read_token(token) + expect(data["type"]).to eq("partner") + expect(data["expires"]).to eq(Time.now.to_i + 3600) + end + end + + context "Group Data" do + let(:payload) do + { + "user_data" => user_data, + "campaign_data" => campaign_data, + "group_data" => group_data + } + end + it "expects token to be successfully decoded" do + token = FlipgiveSDK::Rewards.identified_token(payload) + data = FlipgiveSDK::Rewards.read_token(token) + expect(data).to eq(payload) + end + it "expects error when group_data missing" do + payload["group_data"] = {} + expect { FlipgiveSDK::Rewards.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) + expect(FlipgiveSDK::Rewards.errors).not_to be_empty + expect(FlipgiveSDK::Rewards.errors.count).to eq(1) + expect(FlipgiveSDK::Rewards.errors[0][:group_data]).to eq("name missing.") + end + end + + context "Organization Data" do + let(:payload) do + { + "user_data" => user_data, + "campaign_data" => campaign_data, + "organization_data" => organization_data + } + end + it "expects token to be successfully decoded" do + token = FlipgiveSDK::Rewards.identified_token(payload) + data = FlipgiveSDK::Rewards.read_token(token) + expect(data).to eq(payload) + end + it "expects error when organization_data missing" do + payload["organization_data"] = {} + expect { FlipgiveSDK::Rewards.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) + expect(FlipgiveSDK::Rewards.errors).not_to be_empty + expect(FlipgiveSDK::Rewards.errors.count).to eq(6) + expect(FlipgiveSDK::Rewards.errors[0][:organization_data]).to eq("id missing.") + expect(FlipgiveSDK::Rewards.errors[1][:organization_data]).to eq("name missing.") + end + end +end diff --git a/spec/flipgive_sdk/shop_cloud_spec.rb b/spec/flipgive_sdk/shop_cloud_spec.rb deleted file mode 100644 index b4e53ac..0000000 --- a/spec/flipgive_sdk/shop_cloud_spec.rb +++ /dev/null @@ -1,147 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" -# verysecrettoken57e6323c7c74bba0e9fd4d702aeea756c0901e3a6b453671a - -RSpec.describe FlipgiveSDK::ShopCloud do - before(:all) do - FlipgiveSDK::ShopCloud.flip("BB126923", "sk_61c394cf3346077b") - end - - let(:secret) { "61c394cf3346077b" } - let(:cloud_shop_id) { "BB126923" } - - let(:user_data) { ShopCloudHelper.person_data } - let(:campaign_data) { ShopCloudHelper.campaign_data } - let(:group_data) { ShopCloudHelper.group_data } - let(:organization_data) { ShopCloudHelper.organization_data } - - let(:payload) do - { - "user_data" => user_data, - "campaign_data" => campaign_data - } - end - - context "#ShopCloud" do - it "expects ShopCloud to exist" do - expect(FlipgiveSDK::ShopCloud).not_to be nil - end - end - context "#initialize" do - it "expects secret and partner id" do - fg_shop_cloud = FlipgiveSDK::ShopCloud.new("BB126923", "sk_61c394cf3346077b") - expect(fg_shop_cloud).to receive(:secret).and_return(secret) - expect(fg_shop_cloud).to receive(:cloud_shop_id).and_return(cloud_shop_id) - allow(fg_shop_cloud).to receive(:valid_identified?).and_return true - - fg_shop_cloud.identified_token({ foo: "bar" }) - end - end - - context "#token" do - it "expects token to be generated and append cloud_shop_id" do - token = FlipgiveSDK::ShopCloud.identified_token(payload) - regexp = Regexp.new("#{cloud_shop_id}\\z") - - expect(token).to be_kind_of(String) - expect(token).to match(regexp) - end - - it "expects invalid params error" do - payload = "foobar" - - expect { FlipgiveSDK::ShopCloud.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) - end - - it "expects invalid user_data_errors" do - payload["user_data"] = {} - payload["campaign_data"] = nil - - expect { FlipgiveSDK::ShopCloud.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) - expect(FlipgiveSDK::ShopCloud.errors).not_to be_empty - expect(FlipgiveSDK::ShopCloud.errors.count).to eq(5) - expect(FlipgiveSDK::ShopCloud.errors[0][:payload]).to eq("At least must contain user_data or campaign_data.") - expect(FlipgiveSDK::ShopCloud.errors[1][:user_data]).to eq("id missing.") - expect(FlipgiveSDK::ShopCloud.errors[2][:user_data]).to eq("name missing.") - expect(FlipgiveSDK::ShopCloud.errors[3][:user_data]).to eq("email missing.") - expect(FlipgiveSDK::ShopCloud.errors[4][:user_data]).to eq("country must be one of: 'CAN, USA'.") - end - - it "expects invalid campaign_data" do - payload["user_data"] = nil - payload["campaign_data"] = {} - - expect { FlipgiveSDK::ShopCloud.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) - expect(FlipgiveSDK::ShopCloud.errors).not_to be_empty - expect(FlipgiveSDK::ShopCloud.errors.count).to eq(9) - expect(FlipgiveSDK::ShopCloud.errors[0][:payload]).to eq("At least must contain user_data or campaign_data.") - expect(FlipgiveSDK::ShopCloud.errors[1][:campaign_data]).to eq("id missing.") - expect(FlipgiveSDK::ShopCloud.errors[2][:campaign_data]).to eq("name missing.") - expect(FlipgiveSDK::ShopCloud.errors[3][:campaign_data]).to eq("category missing.") - expect(FlipgiveSDK::ShopCloud.errors[4][:campaign_data]).to eq("country must be one of: 'CAN, USA'.") - expect(FlipgiveSDK::ShopCloud.errors[5][:campaign_admin_data]).to eq("id missing.") - expect(FlipgiveSDK::ShopCloud.errors[6][:campaign_admin_data]).to eq("name missing.") - expect(FlipgiveSDK::ShopCloud.errors[7][:campaign_admin_data]).to eq("email missing.") - expect(FlipgiveSDK::ShopCloud.errors[8][:campaign_admin_data]).to eq("country must be one of: 'CAN, USA'.") - end - - it "expects token to be successfully decoded" do - token = FlipgiveSDK::ShopCloud.identified_token(payload) - data = FlipgiveSDK::ShopCloud.read_token(token) - expect(data).to eq(payload) - end - - it "Partner token has partner_token type" do - token = FlipgiveSDK::ShopCloud.partner_token - data = FlipgiveSDK::ShopCloud.read_token(token) - expect(data["type"]).to eq("partner") - expect(data["expires"]).to eq(Time.now.to_i + 3600) - end - end - - context "Group Data" do - let(:payload) do - { - "user_data" => user_data, - "campaign_data" => campaign_data, - "group_data" => group_data - } - end - it "expects token to be successfully decoded" do - token = FlipgiveSDK::ShopCloud.identified_token(payload) - data = FlipgiveSDK::ShopCloud.read_token(token) - expect(data).to eq(payload) - end - it "expects error when group_data missing" do - payload["group_data"] = {} - expect { FlipgiveSDK::ShopCloud.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) - expect(FlipgiveSDK::ShopCloud.errors).not_to be_empty - expect(FlipgiveSDK::ShopCloud.errors.count).to eq(1) - expect(FlipgiveSDK::ShopCloud.errors[0][:group_data]).to eq("name missing.") - end - end - - context "Organization Data" do - let(:payload) do - { - "user_data" => user_data, - "campaign_data" => campaign_data, - "organization_data" => organization_data - } - end - it "expects token to be successfully decoded" do - token = FlipgiveSDK::ShopCloud.identified_token(payload) - data = FlipgiveSDK::ShopCloud.read_token(token) - expect(data).to eq(payload) - end - it "expects error when organization_data missing" do - payload["organization_data"] = {} - expect { FlipgiveSDK::ShopCloud.identified_token(payload) }.to raise_error(FlipgiveSDK::Error) - expect(FlipgiveSDK::ShopCloud.errors).not_to be_empty - expect(FlipgiveSDK::ShopCloud.errors.count).to eq(6) - expect(FlipgiveSDK::ShopCloud.errors[0][:organization_data]).to eq("id missing.") - expect(FlipgiveSDK::ShopCloud.errors[1][:organization_data]).to eq("name missing.") - end - end -end diff --git a/spec/flipgive_sdk_spec.rb b/spec/flipgive_sdk_spec.rb index add5cf0..7764dfe 100644 --- a/spec/flipgive_sdk_spec.rb +++ b/spec/flipgive_sdk_spec.rb @@ -5,7 +5,7 @@ expect(FlipgiveSDK::VERSION).not_to be nil end - it "expects ShopCloud to exist" do - expect(FlipgiveSDK::ShopCloud).not_to be nil + it "expects Rewards to exist" do + expect(FlipgiveSDK::Rewards).not_to be nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e922ed3..3c1e026 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,7 +15,7 @@ end end -class ShopCloudHelper +class RewardsHelper class << self def person_data nom = Faker::Movies::StarWars.character From f7b403100d2347836e569b25bce72132fb4d9f7f Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 8 Feb 2024 17:02:25 -0500 Subject: [PATCH 2/4] better text --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0114dc..db938d4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the gem to your Gemfile: gem 'flipgive_sdk', git: "https://github.com/BetterTheWorld/FlipGiveSDK_Ruby.git" ``` -After you have installed the gem include the code below to initialize the Rewards: +After you have installed the gem include the code below to initialize the SDK: ```ruby FlipgiveSDK::Rewards.flip(ENV['rewards_id'], ENV['rewards_secret']) From ab212e28de7705062f8625a164a3c6d3d8b77faf Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 8 Feb 2024 17:04:00 -0500 Subject: [PATCH 3/4] better text --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db938d4..07fe964 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ FlipgiveSDK::Rewards.flip(ENV['rewards_id'], ENV['rewards_secret']) ``` We recommend using its own initializer file `myapp/config/initializers/rewards.rb`. -Rewards is now ready to use. - +The SDK is now ready to use. +se ### Usage The main purpose of `FlipgiveSDK::Rewards` is to generate Tokens to gain access to FlipGive's Rewards API. There are 6 methods on the gem's public API. From 6b158620e5c518fb28f1f1b79604b77f5b1296c7 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 9 Feb 2024 10:21:33 -0500 Subject: [PATCH 4/4] rubocop --- lib/flipgive_sdk/rewards.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flipgive_sdk/rewards.rb b/lib/flipgive_sdk/rewards.rb index d3a0d66..8c04848 100644 --- a/lib/flipgive_sdk/rewards.rb +++ b/lib/flipgive_sdk/rewards.rb @@ -69,7 +69,7 @@ def valid_identified?(payload) end def partner_token - payload = { type: "partner", expires: partner_token_expiration } + payload = { type: "partner", expires: partner_token_expiration } token = JWE.encrypt(payload.to_json, secret, alg: "dir") [token, id].join("@") end