Browse files

rename Base#attributes to Base#attributes_on to make way for change

  • Loading branch information...
1 parent 5f1538f commit ab9aec629435abd84dff1de2642cc451ee1f51c2 @thomas-mcdonald committed Mar 1, 2012
View
3 lib/serel/access_token.rb
@@ -5,7 +5,8 @@ module Serel
# Creating a new AccessToken provides a couple of helper methods to access authorized methods and
# identify who a user is.
class AccessToken < Base
- attributes :token
+ attributes_on :token
+
finder_methods :none
# Create a new instance of AccessToken.
View
2 lib/serel/answer.rb
@@ -39,7 +39,7 @@ module Serel
#
# Retrieves answers by a given user
class Answer < Base
- attributes :answer_id, :body, :community_owned_date, :creation_date, :down_vote_count, :is_accepted, :last_activity_date, :last_edit_date, :link, :locked_date, :question_id, :score, :title, :up_vote_count
+ attributes_on :answer_id, :body, :community_owned_date, :creation_date, :down_vote_count, :is_accepted, :last_activity_date, :last_edit_date, :link, :locked_date, :question_id, :score, :title, :up_vote_count
alias :id :answer_id
associations :comments => :comment, :owner => :user
View
2 lib/serel/badge.rb
@@ -41,7 +41,7 @@ module Serel
#
# See the documentation for {tags} below.
class Badge < Base
- attributes :badge_id, :badge_type, :description, :link, :name, :rank
+ attributes_on :badge_id, :badge_type, :description, :link, :name, :rank
alias :id :badge_id
associations :user => :user
View
2 lib/serel/base.rb
@@ -61,7 +61,7 @@ def inspect
# *splat - The Array or List of attributes for the class
#
# Returns nothing.
- def self.attributes(*splat)
+ def self.attributes_on(*splat)
self.attributes = {}
splat.each do |meth|
self.attributes[meth] = String
View
2 lib/serel/comment.rb
@@ -51,7 +51,7 @@ module Serel
#
# Retrieves a page of comments mentioning the specified user.
class Comment < Base
- attributes :comment_id, :body, :creation_date, :edited, :link, :post_id, :post_type, :score
+ attributes_on :comment_id, :body, :creation_date, :edited, :link, :post_id, :post_type, :score
alias :id :comment_id
associations :owner => :user, :reply_to_user => :user
View
2 lib/serel/event.rb
@@ -19,7 +19,7 @@ module Serel
# Retrieves a page of Events. As per the +all+ method above, this defaults to events in the last 5
# minutes.
class Event < Base
- attributes :event_type, :event_id, :creation_date, :link, :excerpt
+ attributes_on :event_type, :event_id, :creation_date, :link, :excerpt
finder_methods :all, :get
end
end
View
2 lib/serel/inbox.rb
@@ -1,6 +1,6 @@
module Serel
class Inbox < Base
- attributes :item_type, :question_id, :answer_id, :comment_id, :title, :creation_date, :is_unread, :site, :body, :link
+ attributes_on :item_type, :question_id, :answer_id, :comment_id, :title, :creation_date, :is_unread, :site, :body, :link
finder_methods :none
end
end
View
2 lib/serel/info.rb
@@ -5,7 +5,7 @@ module Serel
# The +/info+ route accepts no parameters and requires no IDs, so the default finder methods cannot be
# used. We therefore have a custom finder defined, {.get_info}.
class Info < Base
- attributes :total_questions, :total_unanswered, :total_accepted, :total_answers, :questions_per_minute, :answers_per_minute, :total_comments, :total_votes, :total_badges, :badges_per_minute, :total_users, :new_active_users, :api_revision
+ attributes_on :total_questions, :total_unanswered, :total_accepted, :total_answers, :questions_per_minute, :answers_per_minute, :total_comments, :total_votes, :total_badges, :badges_per_minute, :total_users, :new_active_users, :api_revision
associations :site => :site
finder_methods :none
View
2 lib/serel/post.rb
@@ -1,6 +1,6 @@
module Serel
class Post < Base
- attributes :post_id, :post_type, :body, :creation_date, :last_activity_date, :last_edit_date, :score, :up_vote_count, :down_vote_count
+ attributes_on :post_id, :post_type, :body, :creation_date, :last_activity_date, :last_edit_date, :score, :up_vote_count, :down_vote_count
alias :id :post_id
associations :comments => :comment, :owner => :user
View
2 lib/serel/privilege.rb
@@ -1,6 +1,6 @@
module Serel
class Privilege < Base
- attributes :short_description, :description, :reputation
+ attributes_on :short_description, :description, :reputation
finder_methods :all
end
end
View
2 lib/serel/question.rb
@@ -1,6 +1,6 @@
module Serel
class Question < Base
- attributes :question_id, :accepted_answer_id, :answer_count, :body, :bounty_amount, :bounty_closes_date, :closed_reason, :community_owned_date, :creation_date, :down_vote_count, :favourite_count, :last_activity_date, :last_edit_date, :link, :locked_date, :migrated_to, :migrated_from, :protected_date, :score, :tags, :title, :up_vote_count, :view_count
+ attributes_on :question_id, :accepted_answer_id, :answer_count, :body, :bounty_amount, :bounty_closes_date, :closed_reason, :community_owned_date, :creation_date, :down_vote_count, :favourite_count, :last_activity_date, :last_edit_date, :link, :locked_date, :migrated_to, :migrated_from, :protected_date, :score, :tags, :title, :up_vote_count, :view_count
associations :answers => :answer, :comments => :comment, :owner => :user
alias :id :question_id
finder_methods :every
View
2 lib/serel/reputation.rb
@@ -1,6 +1,6 @@
module Serel
class Reputation < Base
- attributes :user_id, :post_id, :post_type, :vote_type, :title, :link, :reputation_change, :on_date
+ attributes_on :user_id, :post_id, :post_type, :vote_type, :title, :link, :reputation_change, :on_date
finder_methods :none
end
end
View
2 lib/serel/revision.rb
@@ -1,6 +1,6 @@
module Serel
class Revision < Base
- attributes :revision_guid, :revision_number, :revision_type, :post_type, :post_id, :comment, :creation_date, :is_rollback, :last_body, :last_title, :last_tags, :body, :title, :tags, :set_community_wiki
+ attributes_on :revision_guid, :revision_number, :revision_type, :post_type, :post_id, :comment, :creation_date, :is_rollback, :last_body, :last_title, :last_tags, :body, :title, :tags, :set_community_wiki
alias :id :revision_guid
associations :user => :user
View
2 lib/serel/site.rb
@@ -15,7 +15,7 @@ module Serel
#
# Retrieves a page of sites, applying any scopes that have previously been defined.
class Site < Base
- attributes :site_type, :name, :logo_url, :api_site_parameter, :site_url, :audience, :icon_url, :aliases, :site_state, :styling, :closed_beta_date, :open_beta_date, :launch_date, :favicon_url, :related_sites, :twitter_account, :markdown_extensions
+ attributes_on :site_type, :name, :logo_url, :api_site_parameter, :site_url, :audience, :icon_url, :aliases, :site_state, :styling, :closed_beta_date, :open_beta_date, :launch_date, :favicon_url, :related_sites, :twitter_account, :markdown_extensions
finder_methods :all, :get
network_wide
end
View
2 lib/serel/suggested_edit.rb
@@ -1,6 +1,6 @@
module Serel
class SuggestedEdit < Base
- attributes :suggested_edit_id, :post_id, :post_type, :body, :title, :tags, :comment, :creation_date, :approval_date, :rejection_date
+ attributes_on :suggested_edit_id, :post_id, :post_type, :body, :title, :tags, :comment, :creation_date, :approval_date, :rejection_date
alias :id :suggested_edit_id
associations :proposing_user => :user
finder_methods :every
View
2 lib/serel/tag.rb
@@ -1,6 +1,6 @@
module Serel
class Tag < Base
- attributes :name, :count, :is_required, :is_moderator_only, :user_id, :has_synonyms, :last_activity_date
+ attributes_on :name, :count, :is_required, :is_moderator_only, :user_id, :has_synonyms, :last_activity_date
finder_methods :all, :get
# Finds a tag by name
View
2 lib/serel/tag_score.rb
@@ -1,6 +1,6 @@
module Serel
class TagScore < Base
- attributes :score, :post_count
+ attributes_on :score, :post_count
associations :user => :user
finder_methods :none
end
View
2 lib/serel/tag_synonym.rb
@@ -1,6 +1,6 @@
module Serel
class TagSynonym < Base
- attributes :from_tag, :to_tag, :applied_count, :last_applied_date, :creation_date
+ attributes_on :from_tag, :to_tag, :applied_count, :last_applied_date, :creation_date
finder_methods :none
end
end
View
2 lib/serel/tag_wiki.rb
@@ -1,6 +1,6 @@
module Serel
class TagWiki < Base
- attributes :tag_name, :body, :excerpt, :body_last_edit_date, :excerpt_last_edit_date
+ attributes_on :tag_name, :body, :excerpt, :body_last_edit_date, :excerpt_last_edit_date
associations :last_body_editor => :user, :last_excerpt_editor => :user
finder_methods :none
end
View
2 lib/serel/timeline.rb
@@ -1,6 +1,6 @@
module Serel
class Timeline < Base
- attributes :timeline_type, :question_id, :post_id, :comment_id, :revision_guid, :up_vote_count, :down_vote_count, :creation_date
+ attributes_on :timeline_type, :question_id, :post_id, :comment_id, :revision_guid, :up_vote_count, :down_vote_count, :creation_date
associations :user => :user, :owner => :user
finder_methods :every
end
View
2 lib/serel/user.rb
@@ -1,6 +1,6 @@
module Serel
class User < Base
- attributes :user_id, :user_type, :creation_date, :display_name, :profile_image, :reputation, :reputation_change_day, :reputation_change_week, :reputation_change_month, :reputation_change_quarter, :reputation_change_year, :age, :last_access_date, :last_modified_date, :is_employee, :link, :website_url, :location, :account_id, :timed_penalty_date, :badge_counts, :question_counts, :answer_count, :up_vote_count, :down_vote_count, :about_me, :view_count, :accept_rate
+ attributes_on :user_id, :user_type, :creation_date, :display_name, :profile_image, :reputation, :reputation_change_day, :reputation_change_week, :reputation_change_month, :reputation_change_quarter, :reputation_change_year, :age, :last_access_date, :last_modified_date, :is_employee, :link, :website_url, :location, :account_id, :timed_penalty_date, :badge_counts, :question_counts, :answer_count, :up_vote_count, :down_vote_count, :about_me, :view_count, :accept_rate
alias :id :user_id
finder_methods :every
View
4 spec/serel/base_spec.rb
@@ -2,11 +2,11 @@
# Test classes and other unimportant stuff.
class OneAttribute < Serel::Base
- attributes :test
+ attributes_on :test
end
class MultipleAttribute < Serel::Base
- attributes :testing, :test_id
+ attributes_on :testing, :test_id
end
describe Serel::Base do

0 comments on commit ab9aec6

Please sign in to comment.