Class: Sourcing::Person
- Defined in:
- lib/sourcing/person.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_note!(body) ⇒ Object
- #favorite! ⇒ Object
- #notes ⇒ Object
- #tweets ⇒ Object
- #unfavorite! ⇒ Object
Class Method Details
.find(values, options = {}) ⇒ Object Also known as: []
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sourcing/person.rb', line 5 def self.find(values, = {}) unless values.is_a?(Hash) values = {:id => values} end = .dup params = .delete(:params) || {} if email = values[:email] self.new(get(uri(:email, email), params, )) elsif twitter = values[:twitter] self.new(get(uri(:twitter, twitter), params, )) elsif github = values[:github] self.new(get(uri(:github, github), params, )) elsif name = values[:name] self.new(get(uri(:name, URI.escape(name)), params, )) elsif id = values[:id] self.new(get(id, params, )) else raise ArgumentError, 'Invalid values' end rescue Nestful::ResourceNotFound end |
.search(filters, params = {}) ⇒ Object
35 36 37 |
# File 'lib/sourcing/person.rb', line 35 def self.search(filters, params = {}) post :search, params.merge(filters: filters) end |
Instance Method Details
#create_note!(body) ⇒ Object
51 52 53 |
# File 'lib/sourcing/person.rb', line 51 def create_note!(body) post :notes, body: body end |
#favorite! ⇒ Object
55 56 57 |
# File 'lib/sourcing/person.rb', line 55 def favorite! post :favorite end |
#notes ⇒ Object
47 48 49 |
# File 'lib/sourcing/person.rb', line 47 def notes get :notes end |
#tweets ⇒ Object
43 44 45 |
# File 'lib/sourcing/person.rb', line 43 def tweets get :tweets end |
#unfavorite! ⇒ Object
59 60 61 |
# File 'lib/sourcing/person.rb', line 59 def unfavorite! delete :favorite end |