Class: Gitwrap::User
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Gitwrap::User
- Includes:
- HTTParty
- Defined in:
- lib/gitwrap/users.rb
Class Method Summary collapse
- .fetch_all_users(id) ⇒ Object
- .fetch_single_user(username) ⇒ Object
- .fetch_users_by_language(language) ⇒ Object
- .fetch_users_by_location(location) ⇒ Object
- .fetch_users_by_location_and_language(location, language) ⇒ Object
Class Method Details
.fetch_all_users(id) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitwrap/users.rb', line 17 def self.fetch_all_users(id) response = get("/users?since=#{id}") if response.success? response = response.parsed_response response.each { |user| $users << new(user) } else raise_exception(response.code, response.body) end $users end |
.fetch_single_user(username) ⇒ Object
12 13 14 15 |
# File 'lib/gitwrap/users.rb', line 12 def self.fetch_single_user(username) response = get("/users/#{username}") if response.success? then user = new(response) else raise_exception(response.code, response.body) end end |
.fetch_users_by_language(language) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gitwrap/users.rb', line 28 def self.fetch_users_by_language(language) response = get("/search/users?q=language:#{language}&per_page=100") if response.success? response = response["items"] response.each {|user| $users << new(user)} else raise_exception(response.code, response.body) end $users end |
.fetch_users_by_location(location) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gitwrap/users.rb', line 39 def self.fetch_users_by_location(location) response = get("/search/users?q=location:#{location}&per_page=100") if response.success? response = response["items"] response.each { |user| $users << new(user) } else raise_exception(response.code, response.body) end $users end |
.fetch_users_by_location_and_language(location, language) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gitwrap/users.rb', line 50 def self.fetch_users_by_location_and_language(location, language) response = get("/search/users?q=location:#{location}+language:#{language}&per_page=100") if response.success? response = response["items"] response.each { |user| $users << new(user) } else raise_exception(response.code, response.body) end $users end |