Skip to content

Commit

Permalink
Merge branch 'treasury-models'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/etsy/featured_treasury.rb
  • Loading branch information
Muon committed Jun 26, 2012
2 parents a811dcd + 7c8fd64 commit e9142af
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions lib/etsy/featured_treasury.rb
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
module Etsy
class FeaturedTreasury
class FeaturedTreasury

include Etsy::Model
include Etsy::Model

attribute :id, :from => :treasury_id
attribute :owner_id, :from => :treasury_owner_id
attributes :url, :region, :active_date
attribute :id, :from => :treasury_id
attribute :owner_id, :from => :treasury_owner_id
attributes :url, :region, :active_date


def self.find_all(options={})
get_all('/featured_treasuries', options)
end
def self.find_all(options={})
get_all('/featured_treasuries', options)
end

def self.find(*identifiers_and_options)
find_one_or_more('featured_treasuries', identifiers_and_options)
end
def self.find(*identifiers_and_options)
find_one_or_more('featured_treasuries', identifiers_and_options)
end

def self.find_all_by_owner(user_id, options = {})
get_all("/featured_treasuries/owner/#{user_id}", options)
end
def self.find_all_by_owner(user_id, options = {})
get_all("/featured_treasuries/owner/#{user_id}", options)
end

def owner(*options)
Etsy::User.find(owner_id, *options)
end
def owner(*options)
Etsy::User.find(owner_id, *options)
end

def treasury(*options)
Etsy::Treasury.find(URI(url).path.split('/').last, *options)
end
def listings(*options)
Etsy::Listing.get_all("/featured_treasuries/#{id}/listings", *options)
end

def activated_at
Time.at(active_date)
end
end
end
def treasury(*options)
Etsy::Treasury.find(URI(url).path.split('/').last, *options)
end

def activated_at
Time.at(active_date)
end
end
end

0 comments on commit e9142af

Please sign in to comment.