Top Level Namespace
Defined Under Namespace
Modules: Eloqua, EloquaApiExceptions, UrlHelper
Constant Summary
collapse
- DEFAULT_API_VERSION =
'2.0'.freeze
- DEFAULT_AUTHORIZATION_TYPE =
'Bearer'.freeze
- TEST_SAMPLE_URL =
'https://eloqua-api-wrapper.com/API/REST/{version}/'.freeze
- TEST_SAMPLE_TOKEN =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'.freeze
- HTTP_OK_CODE =
200
- HTTP_BAD_REQUEST_CODE =
400
- HTTP_UNAUTHORIZED_CODE =
401
- HTTP_FORBIDDEN_CODE =
403
- HTTP_NOT_FOUND_CODE =
404
- HTTP_SERVER_ERROR =
500
- ELOQUA_ENDPOINTS =
{
external_assets_types: {
endpoint: '/assets/external/types',
method: :get
}.freeze,
single_asset_activities: {
endpoint: '/assets/external/type/{id}',
method: :get
}.freeze,
all_campaigns: {
endpoint: '/assets/campaigns',
method: :get
}.freeze,
single_campaign: {
endpoint: '/assets/campaign/{id}',
method: :get
}.freeze,
update_campaign: {
endpoint: '/assets/campaign/{id}',
method: :put
}.freeze,
create_campaign: {
endpoint: '/assets/campaign',
method: :post
}.freeze,
activate_campaign: {
endpoint: '/assets/campaign/active/{id}',
method: :post
}.freeze,
deactive_campaign: {
endpoint: '/assets/campaign/draft/{id}',
method: :post
}.freeze,
delete_campaign: {
endpoint: '/assets/campaign/{id}',
method: :delete
}.freeze,
create_external_activity: {
endpoint: '/data/activity',
method: :post
}.freeze
}.freeze
Instance Method Summary
collapse
Instance Method Details
#mock_request(method, url, response) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/constants/mock_request_helper.rb', line 11
def mock_request(method, url, response)
WebMock.stub_request(method, url)
.to_return(
status: 200,
body: response,
headers: { content_type: 'application/json' }
)
end
|
#mock_request_with(method, url, response, body = {}, request_headers = {}) ⇒ Object
1
2
3
4
5
6
7
8
9
|
# File 'lib/constants/mock_request_helper.rb', line 1
def mock_request_with(method, url, response, body = {}, = {})
WebMock.stub_request(method, url)
.with(body: body, headers: )
.to_return(
status: 200,
body: response,
headers: { content_type: 'application/json' }
)
end
|