Class: BlogMarks::Client
- Inherits:
-
Object
- Object
- BlogMarks::Client
- Defined in:
- lib/blogmarks/client.rb
Constant Summary collapse
- @@api_url =
'http://api.blogmarks.net'
- @@user_agent =
'Ruby BlogmarksClient Library'
- @@private_text =
'Ipsum Dolor Sit Amet'
Instance Attribute Summary collapse
-
#feed ⇒ Object
readonly
Store the fetched Feed.
-
#password ⇒ Object
User password.
-
#user ⇒ Object
User login.
Instance Method Summary collapse
-
#add_mark(mark) ⇒ Object
Add a Mark.
-
#delete_mark(mark) ⇒ Object
Delete a Mark.
-
#find_marks(options = {}) ⇒ Object
Find some marks in public marks This function accept an options hash, where options can be :.
-
#find_my_marks(options = {}) ⇒ Object
Find some marks in my marks.
-
#initialize(user, password) ⇒ Client
constructor
Blogmarks client constructor.
-
#update_mark(mark) ⇒ Object
Update a Mark.
Constructor Details
#initialize(user, password) ⇒ Client
Blogmarks client constructor
61 62 63 64 65 |
# File 'lib/blogmarks/client.rb', line 61 def initialize( user, password) @user = user @password = password @feed = nil end |
Instance Attribute Details
#feed ⇒ Object (readonly)
Store the fetched Feed
54 55 56 |
# File 'lib/blogmarks/client.rb', line 54 def feed @feed end |
#password ⇒ Object
User password
58 59 60 |
# File 'lib/blogmarks/client.rb', line 58 def password @password end |
#user ⇒ Object
User login
56 57 58 |
# File 'lib/blogmarks/client.rb', line 56 def user @user end |
Instance Method Details
#add_mark(mark) ⇒ Object
Add a Mark
68 69 70 |
# File 'lib/blogmarks/client.rb', line 68 def add_mark( mark ) end |
#delete_mark(mark) ⇒ Object
Delete a Mark
78 79 80 |
# File 'lib/blogmarks/client.rb', line 78 def delete_mark( mark ) end |
#find_marks(options = {}) ⇒ Object
Find some marks in public marks
This function accept an options hash, where options can be :
-
:last
integer from -1 to …Limit number of results (default: 30)
-
:offset
positive integerFirst result offset, for paging... (default: 0)
-
:search
stringSearches for string in blogmarks (title, desc) + tags
-
:tags
stringSearches for requested public tags
-
:private_tags
stringRecherche les blogmarks contenant les tags privés indiqués (*).
-
:related
regexp???
-
:author
string <user>Searches only in <user>'s marks
-
:private
true | falseIf true, also search in private marks (default: false)
-
:month
integer 01 to 12if used with year, search only in marks posted durint that month
-
:year
integer YYYYRestrict search to marks posted during that year
-
:level
positive integer <level>Restrict search to marks posted by at least <level> users
-
:order_by
issued|modified|created|popularityResults sorting mode (default: issued)
-
:order_type
asc|descResults dorting direction (default: desc)
112 113 114 115 116 117 118 |
# File 'lib/blogmarks/client.rb', line 112 def find_marks( ={} ) url = build_url( "#{api_url}/marks", ) res = send_request(url) parse_xml_response(res) end |
#find_my_marks(options = {}) ⇒ Object
Find some marks in my marks
This function is an alias to find_mark which set the :author option to current user in options hash. For accepted options see #find_marks
124 125 126 127 |
# File 'lib/blogmarks/client.rb', line 124 def find_my_marks( ={} ) [:author] = @user find_marks() end |
#update_mark(mark) ⇒ Object
Update a Mark
73 74 75 |
# File 'lib/blogmarks/client.rb', line 73 def update_mark( mark ) end |