Skip to content

Latest commit

 

History

History
270 lines (175 loc) · 7.47 KB

CHANGELOG.md

File metadata and controls

270 lines (175 loc) · 7.47 KB

2.9.0

Additions

1. New Account client

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
client.account.info

2.8.2

  • Fix TooManyRequest handler

2.8.1

  • Makes the retryable_request method also retry when a RDStation::Error::Unauthorized error happen

2.8.0

Additions

1. New Analytics client: conversions

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
query_params =  { start_date:'2022-11-13', end_date:'2022-11-15', assets_type:['LandingPage'] }
client.analytics.conversions(query_params)

2. New landing_pages client

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
client.landing_pages.all

2.7.0

Additions

1. New Analytics client

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
query_params =  { start_date:'2022-11-02', end_date:'2022-11-08' }
client.analytics.email_marketing(query_params)

2.6.0

Additions

1. New Emails client

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
client.emails.all

2. New Segmentations client

Usage example:

client = RDStation::Client.new(access_token: 'access_token', refresh_token: 'refresh_token')
client.segmentations.all

2.5.1

  • Fixed checking empty? for nil values inside of InvalidRefreshToken class

2.5.0

  • InvalidRefreshToken error added. This error will be raised when the refresh token is invalid or it was revoked. When you get this error, you can safely disconnect the user from RD Station.

Usage example:

begin
  rdstation.update_access_token(refresh_token)
rescue RDStation::Error::InvalidRefreshToken
  # Disconnect user
end

2.4.0

  • Add the TooManyRequests errors in case of rate limit exceeded. See API request limit for more details

2.3.1

  • Fixed a bug when no error is found in the known errors list (issue #52)

2.3.0

Additions

1. New Field methods

The following methods were added to "Fields" client:

  • create
  • update
  • delete

Besides reading, this client is now capable of create, update or delete a field.

Usage example:

client = RDStation::Client.new(access_token: 'ACCESS_TOKEN', refresh_token: 'REFRESH_TOKEN')
client.fields.delete('FIELD_UUID')

2. New format of errors supported

Two new formats of errors are now supported by the error handler:

HASH_OF_HASHES

When the error message is a hash containing other hashes as values, for example:

{
  'error' => {
    'field1' => {...},
    'field2' => {...}
  }
}
HASH_OF_MULTIPLE_TYPES

When the error message is a hash that could contain multiple data types as values, for example:

{
  'error' => {
    'field1' => [...] # Array,
    'field2' => {...} # Hash
  }
}

2.2.0

Additions

Configuration

Now it is possible to configure global params like client_id and client_secret only once, so you don't need to provide them to RDStation::Authentication every time.

This can be done in the following way:

RDStation.configure do |config|
  config.client_id = YOUR_CLIENT_ID
  config.client_secret = YOUR_CLIENT_SECRET
end

If you're using Rails, this can be done in config/initializers.

Automatic refresh of access_tokens

When an access_token expires, a new one will be obtained automatically and the request will be made again.

For this to work, you have to use RDStation.configure as described above, and provide the refresh token when instantiating RDStation::Client (ex: RDStation::Client.new(access_token: MY_ACCESS_TOKEN, refresh_token: MY_REFRESH_TOKEN).

You can keep track of access_token changes, by providing a callback block inconfiguration. This block will be called with an RDStation::Authorization object, which contains the updated access_token and refresh_token. For example:

RDStation.configure do |config|
  config.on_access_token_refresh do |authorization|
    MyStoredAuth.where(refresh_token: authorization.refresh_token).update_all(access_token: authorization.access_token)
  end
end

Deprecations

Providing client_id and client_secret directly to RDStation::Authentication.new is deprecated and will be removed in future versions. Use RDStation.configure instead.

Specifying refresh_token in RDStation::Client.new(access_token: 'at', refresh_token: 'rt') is optional right now, but will be mandatory in future versions.

2.1.1

  • Fixed a bug in error handling (issue #47)

2.1.0

Additions

RDStation::Authentication.revoke added. This method revokes an access_token at RD Station.

2.0.0

Removals

All API methods that were called directly on RDStation::Client (ex: RDStation::Client.new('rdstation_token', 'auth_token').create_lead(lead_info)) have been removed. See the migration guide for a comprehensive guide on how to upgrade from version 1.2.x.

Notable changes

RDStation::Client

Now RDStation::Client is facade to all available endpoints in the 2.0 API. It needs to be instantiated with an access_token and has accessors to those endpoints. Usage examples:

  client = RDStation::Client.new((access_token: 'my_token')
  client.contacts.by_uuid('CONTACT_UUID')
  client.webhooks.all
  client.events.create(my_json_payload)
  client.fields.all

RDStation::Contacts, RDStation::Events, RDStation::Fields and RDStation::Webhooks are not suposed to be instantiated directly anymore. Use RDStation::Client to get them instead.

Error handling

Now specific errors are raised for each HTTP status:

  • RDStation::Error::BadRequest (400)
  • RDStation::Error::Unauthorized (401)
  • RDStation::Error::Forbidden (403)
  • RDStation::Error::NotFound (404)
  • RDStation::Error::MethodNotAllowed (405)
  • RDStation::Error::NotAcceptable (406)
  • RDStation::Error::Conflict (409)
  • RDStation::Error::UnsupportedMediaType (415)
  • RDStation::Error::UnprocessableEntity (422)
  • RDStation::Error::InternalServerError (500)
  • RDStation::Error::NotImplemented (501)
  • RDStation::Error::BadGateway (502)
  • RDStation::Error::ServiceUnavailable (503)
  • RDStation::Error::ServerError (which is returned for 5xx errors different than 500, 501, 502 or 503)

In case of a Bad Request (400), the following specific errors may be raised (those are subclasses of RDStation::Error::BadRequest):

  • RDStation::Error::ConflictingField
  • RDStation::Error::InvalidEventType

In cause of Unauthorized (401), the following specific errors may be raised (those are subclasses of RDStation::Error::Unauthorized):

  • RDStation::Error::ExpiredAccessToken
  • RDStation::Error::ExpiredCodeGrant
  • RDStation::Error::InvalidCredentials

The specific message and the http code are now returned by the details method.

Dependencies

rdstation-ruby-client now requires ruby >= 2.0.0.

1.2.1

Deprecations

All API methods that were called directly on RDStation::Client (ex: RDStation::Client.new('rdstation_token', 'auth_token').create_lead(lead_info)) are now deprecated. Those methods call RDSM's 1.3 API and will be removed in the next release.