Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move Moretext API URL to constant.
  • Loading branch information
chinghanho committed Mar 24, 2013
1 parent bb3faf9 commit e2c4f2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/chh_moretext.rb
Expand Up @@ -4,12 +4,14 @@

module ChhMoretext
class Base
MORETEXT_API_URL = "http://more.handlino.com/sentences.json"

class << self
def fetch_moretext(number, limit)
number = "n=#{number}"
limit = parse(limit)
condition = limit.nil? ? "?#{number}" : "?#{number}&#{limit}"
return JSON(open("http://more.handlino.com/sentences.json#{condition}").read)["sentences"]
return JSON(open("#{MORETEXT_API_URL}#{condition}").read)["sentences"]
end
end

Expand Down

0 comments on commit e2c4f2f

Please sign in to comment.