Skip to content

Commit

Permalink
Merge pull request #10 from fulcrumapp/extract-media-modules
Browse files Browse the repository at this point in the history
Extract media modules
  • Loading branch information
zhm committed Aug 31, 2015
2 parents c912256 + 933371a commit 12252df
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ Downloads the small version and yields an IO object to the block.

Downloads the medium version and yields an IO object to the block.

### client.videos.track(id)
### client.videos.track(id, format='json')

Fetches the GPS track for the specified video.

Format can be 'json', 'geojson', 'gpx', or 'kml'.



## Audio
Expand Down Expand Up @@ -261,10 +263,12 @@ Downloads the small version and yields an IO object to the block.

Downloads the medium version and yields an IO object to the block.

### client.audio.track(id)
### client.audio.track(id, format='json')

Fetches the GPS track for the specified audio.

Format can be 'json', 'geojson', 'gpx', or 'kml'.



## Memberships
Expand Down Expand Up @@ -312,3 +316,4 @@ Fetches the GPS track for the specified audio.
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

5 changes: 4 additions & 1 deletion lib/fulcrum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
require 'fulcrum/form'
require 'fulcrum/membership'
require 'fulcrum/photo'
require 'fulcrum/actions/media_versions'
require 'fulcrum/actions/gps_track'
require 'fulcrum/video'
require 'fulcrum/audio'
require 'fulcrum/signature'
Expand All @@ -21,4 +23,5 @@
require 'fulcrum/layer'
require 'fulcrum/changeset'
require 'fulcrum/webhook'
require 'fulcrum/client'
require 'fulcrum/client'

9 changes: 9 additions & 0 deletions lib/fulcrum/actions/gps_track.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Fulcrum
module GpsTrack
extend ActiveSupport::Concern

def track(id, format='json')
call(:get, member_action(id, 'track', format))
end
end
end
13 changes: 13 additions & 0 deletions lib/fulcrum/actions/media_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Fulcrum
module MediaVersions
extend ActiveSupport::Concern

def small(id, &blk)
download_version(id, 'small', &blk)
end

def medium(id, &blk)
download_version(id, 'medium', &blk)
end
end
end
15 changes: 3 additions & 12 deletions lib/fulcrum/audio.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module Fulcrum
class Audio < MediaResource
include MediaVersions
include GpsTrack

def resources_name
resource_name
end
Expand All @@ -11,17 +14,5 @@ def default_content_type
def create_action
'audio/upload'
end

def small(id, &blk)
download_version(id, 'small', &blk)
end

def medium(id, &blk)
download_version(id, 'medium', &blk)
end

def track(id)
call(:get, member_action(id, 'track'))
end
end
end
15 changes: 3 additions & 12 deletions lib/fulcrum/video.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
module Fulcrum
class Video < MediaResource
include MediaVersions
include GpsTrack

def default_content_type
'video/mp4'
end

def create_action
'videos/upload'
end

def small(id, &blk)
download_version(id, 'small', &blk)
end

def medium(id, &blk)
download_version(id, 'medium', &blk)
end

def track(id)
call(:get, member_action(id, 'track'))
end
end
end

0 comments on commit 12252df

Please sign in to comment.