Skip to content
This repository has been archived by the owner on Dec 21, 2017. It is now read-only.

Apply Link Schemas to Responses #3

Merged
merged 2 commits into from
Sep 30, 2014
Merged

Apply Link Schemas to Responses #3

merged 2 commits into from
Sep 30, 2014

Conversation

petehamilton
Copy link
Contributor

Handles things like converting date-time

- Goes through the keys of the response and coerces the type
  based on required format
- Started with Date Time only but room for extension
@petehamilton
Copy link
Contributor Author

@isaacseymour review?

def apply_link_schema(hash)
definitions = @link_schema.resource_schema.definitions
hash.each do |k, v|
next unless definitions.key?(k) && definitions[k].key?('format')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitions.fetch(k, {}).fetch('format', nil)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot.

petehamilton added a commit that referenced this pull request Sep 30, 2014
@petehamilton petehamilton merged commit 7e545cb into master Sep 30, 2014
@petehamilton petehamilton deleted the apply-link-schema branch September 30, 2014 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants