Sha256: 94af7e2b99b33192c5c0ed813f55e61fe86b93200557a7872684bafd7d3cbd8a

Contents?: true

Size: 797 Bytes

Versions: 5

Compression:

Stored size: 797 Bytes

Contents

module Whatser
  class DataSource < Whatser::Resource
    attr_accessor :id
    attr_accessor :name,:price,:review_count,:media_count,:collection_count,:poi_count
    attr_accessor :users
    
    class << self
      def list(opts={})
        api_request :get, "/api/data_sources", {:query => opts}
      end
      
      def for_users(user_id, opts={})
        user_id = user_id.is_a?(Array) ? user_id.join(',') : user_id
        api_request :get, "/api/data_sources", {:query => {:user_id => user_id}.merge(opts || {})}
      end      
    end
    
    def subscription_url(opts={})
      url = "#{self.class.client.api_uri}/payments/data_sources/#{id}/orders/new?oauth_token=#{self.class.client.oauth_token}"
      url = "#{url}&#{opts.to_params}" unless opts.blank?
      url
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whatser-0.4.0 lib/whatser/resources/data_source.rb
whatser-0.3.2 lib/whatser/resources/data_source.rb
whatser-0.3.1 lib/whatser/resources/data_source.rb
whatser-0.3.0 lib/whatser/resources/data_source.rb
whatser-0.2.0 lib/whatser/resources/data_source.rb