Class: ZohoTools::SpecHelper::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/zoho_tools/mock/spec_helper.rb

Instance Method Summary collapse

Instance Method Details

#stub_refresh_access_tokens(refresh_token, access_token:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/zoho_tools/mock/spec_helper.rb', line 4

def stub_refresh_access_tokens(refresh_token, access_token:)
  stub_request(:post, URI.join(ZohoTools.config.accounts_api_url, '/oauth/v2/token'))
    .with(body: hash_including(client_id: ZohoTools.config.client_id,
                               client_secret: ZohoTools.config.client_secret,
                               refresh_token: refresh_token,
                               grant_type: 'refresh_token'))
    .to_return(status: 200,
               body: { access_token: access_token,
                       scope: 'ZohoCampaigns.campaign.ALL ZohoCampaigns.contact.ALL',
                       api_domain: 'https://www.zohoapis.eu',
                       token_type: 'Bearer',
                       expires_in: 3600 }.to_json)
end