mirror of
				https://github.com/stripe/stripe-ruby.git
				synced 2025-10-30 00:03:01 -04:00 
			
		
		
		
	Adds support for login links
This commit is contained in:
		
							parent
							
								
									f87e1ed219
								
							
						
					
					
						commit
						330763aa02
					
				| @ -52,6 +52,7 @@ require 'stripe/file_upload' | ||||
| require 'stripe/invoice' | ||||
| require 'stripe/invoice_item' | ||||
| require 'stripe/invoice_line_item' | ||||
| require 'stripe/login_link' | ||||
| require 'stripe/order' | ||||
| require 'stripe/order_return' | ||||
| require 'stripe/payout' | ||||
|  | ||||
							
								
								
									
										9
									
								
								lib/stripe/login_link.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								lib/stripe/login_link.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| module Stripe | ||||
|   class LoginLink < APIResource | ||||
|     OBJECT_NAME = 'login_link' | ||||
| 
 | ||||
|     def self.retrieve(id, opts=nil) | ||||
|       raise NotImplementedError.new("Login links do not have IDs and cannot be retrieved. They can only be created using accounts.login_links.create") | ||||
|     end | ||||
|   end | ||||
| end | ||||
| @ -44,6 +44,7 @@ module Stripe | ||||
|         Invoice::OBJECT_NAME              => Invoice, | ||||
|         InvoiceItem::OBJECT_NAME          => InvoiceItem, | ||||
|         InvoiceLineItem::OBJECT_NAME      => InvoiceLineItem, | ||||
|         LoginLink::OBJECT_NAME            => LoginLink, | ||||
|         Order::OBJECT_NAME                => Order, | ||||
|         OrderReturn::OBJECT_NAME          => OrderReturn, | ||||
|         Payout::OBJECT_NAME               => Payout, | ||||
|  | ||||
							
								
								
									
										27
									
								
								test/stripe/login_link_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								test/stripe/login_link_test.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| require File.expand_path('../../test_helper', __FILE__) | ||||
| 
 | ||||
| module Stripe | ||||
|   class LoginLinkTest < Test::Unit::TestCase | ||||
|     FIXTURE = API_FIXTURES.fetch(:login_link) | ||||
| 
 | ||||
|     setup do | ||||
|       account_fixture = API_FIXTURES.fetch(:account) | ||||
|       @account = Stripe::Account.retrieve(account_fixture[:id]) | ||||
|     end | ||||
| 
 | ||||
|     should "not be retrievable" do | ||||
|       assert_raises NotImplementedError do | ||||
|         Stripe::LoginLink.retrieve('foo') | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     should "be creatable" do | ||||
|       stub_request(:post, "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links"). | ||||
|         to_return(body: JSON.generate(FIXTURE)) | ||||
|       login_link = @account.login_links.create | ||||
|       assert_requested :post, | ||||
|         "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links" | ||||
|       assert login_link.kind_of?(Stripe::LoginLink) | ||||
|     end | ||||
|   end | ||||
| end | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user