Commit Graph

7 Commits

Author SHA1 Message Date
Piotr Sarnacki
e1a334678d Fix handling default_branch from pusher
Pusher payloads don't have all of the information that is available in
API V3, so we need to do some normalizing.
2015-12-08 10:18:07 +01:00
Piotr Sarnacki
7ae4d6aa7d Fix handling branches
This commit fixes handling of branches when using both V3 and V2. The
changes include:

  * proper definition of relationships that reflect V3 structure, so for
    example build belongs to a branch
  * setting up inverse records for some of the relationships. without
    doing that Ember Data can handle relationships in a surprising way,
    for example if the same record is referenced in 2 places in a
    belongsTo relationship, Ember Data will remove one of the references
    without proper inverse definitions
  * we need to add id when extracting branch as a relationship. Ember
    Data expects all of the relationships to have an id
  * lastly, we need to mimic the structure of the V3 API in V2 payloads,
    so for a build payload I'm now creating a branch record
2015-12-08 10:18:06 +01:00
Piotr Sarnacki
7187d2ef45 Disable dashboard test for now 2015-12-08 10:18:05 +01:00
Piotr Sarnacki
39a579c9db Fix handling relationships for V2 API
* we should look for both embedded relationship and relationship key,
  so in cases like for commit, when there's a full commit data on
  "commit" property, and only id at "commit_id", we will use commit data
* we can't add @type to V2 fallback, because in other places we chack
  for @type to distinguish V2 and V3 payloads
* there's no need to include a record in "included" if there's only a
  type and an id there
2015-12-08 10:18:04 +01:00
Piotr Sarnacki
c50c01f8ea Properly include relationships for V2 payloads 2015-12-08 10:18:04 +01:00
Piotr Sarnacki
74a9a1603e Update serializers to work with jobs endpoint response 2015-12-08 10:18:03 +01:00
Piotr Sarnacki
d9cff6e8b4 Create adapters and serializers working with v3 and v2 APIs
This commit adds adapters and serializers for v3, but also a fallback
serializer for v2, which allows to handle v2 and v3 payloads at the same
time. This is needed, because when we use v3 endpoint for one of the
models (in this case repo), we can also get embedded records of other
types (like branch or build).
2015-12-08 10:18:02 +01:00