Class: SilverMother::Person

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/silver_mother/person.rb

Constant Summary collapse

PERSONS_PATH =
'persons/'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#personsObject (readonly)

Returns the value of attribute persons.



9
10
11
# File 'lib/silver_mother/person.rb', line 9

def persons
  @persons
end

#persons_rawObject (readonly)

Returns the value of attribute persons_raw.



9
10
11
# File 'lib/silver_mother/person.rb', line 9

def persons_raw
  @persons_raw
end

Instance Method Details

#call(token) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/silver_mother/person.rb', line 11

def call(token)
  @token = token
  @persons_raw = []
  @response = Api.instance.get(PERSONS_PATH, @token)
  @persons_raw << @response
  while next_page
    new_path = PERSONS_PATH + next_page_number
    @response = Api.instance.get(new_path, @token)
    @persons_raw << @response
  end
end

#clear_cache!Object



29
30
31
32
# File 'lib/silver_mother/person.rb', line 29

def clear_cache!
  @persons_raw = []
  @persons     = []
end