Class: BlogMarks::Client

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#feedObject (readonly)

Store the fetched Feed



54
55
56
# File 'lib/blogmarks/client.rb', line 54

def feed
  @feed
end

#passwordObject

User password



58
59
60
# File 'lib/blogmarks/client.rb', line 58

def password
  @password
end

#userObject

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 integer

    First result offset, for paging... (default: 0)
    
  • :search string

    Searches for string in blogmarks (title, desc) + tags
    
  • :tags string

    Searches for requested public tags
    
  • :private_tags string

    Recherche les blogmarks contenant les tags privés indiqués (*).
    
  • :related regexp

    ???
    
  • :author string <user>

    Searches only in <user>'s marks
    
  • :private true | false

    If true, also search in private marks	(default: false)
    
  • :month integer 01 to 12

    if used with year, search only in marks posted durint that month
    
  • :year integer YYYY

    Restrict 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|popularity

    Results sorting mode (default: issued)
    
  • :order_type asc|desc

    Results dorting direction	(default: desc)
    


112
113
114
115
116
117
118
# File 'lib/blogmarks/client.rb', line 112

def find_marks( options={} )
  url = build_url( "#{api_url}/marks", options )
  
  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( options={} )
  options[:author] = @user
  find_marks(options)
end

#update_mark(mark) ⇒ Object

Update a Mark



73
74
75
# File 'lib/blogmarks/client.rb', line 73

def update_mark( mark )
  
end