honest_renter 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +7 -0
- data/Gemfile.lock +23 -1
- data/LICENSE.txt +22 -0
- data/README.md +116 -1
- data/Rakefile +11 -0
- data/honest_renter.gemspec +6 -1
- data/lib/authenticator.rb +76 -0
- data/lib/client.rb +11 -0
- data/lib/honest_renter.rb +12 -0
- data/lib/request.rb +71 -0
- data/lib/requests/expandable.rb +10 -0
- data/lib/requests/filter.rb +9 -0
- data/lib/requests/find_all.rb +27 -0
- data/lib/requests/find_all_by_filter.rb +38 -0
- data/lib/requests/find_by_id.rb +23 -0
- data/lib/requests/post.rb +15 -0
- data/lib/requires.rb +18 -0
- data/lib/response.rb +30 -0
- data/lib/session.rb +20 -0
- data/models/applicant.rb +42 -0
- data/models/base_model.rb +57 -0
- data/models/candidate.rb +31 -0
- data/models/child.rb +20 -0
- data/models/code.rb +27 -0
- data/models/cooccupant.rb +20 -0
- data/models/country.rb +16 -0
- data/models/email.rb +21 -0
- data/models/emergency_contact.rb +20 -0
- data/models/ethnicity.rb +16 -0
- data/models/failed_login.rb +21 -0
- data/models/gender.rb +16 -0
- data/models/inbox_filters.rb +26 -0
- data/models/invite_settings.rb +23 -0
- data/models/member.rb +24 -0
- data/models/name.rb +22 -0
- data/models/notification.rb +18 -0
- data/models/notification_type.rb +19 -0
- data/models/organization.rb +23 -0
- data/models/participant.rb +21 -0
- data/models/person.rb +30 -0
- data/models/pet.rb +22 -0
- data/models/pet_age_category.rb +18 -0
- data/models/pet_size_category.rb +18 -0
- data/models/pet_type.rb +18 -0
- data/models/phone.rb +24 -0
- data/models/phone_type.rb +18 -0
- data/models/position.rb +23 -0
- data/models/reason_for_archive.rb +18 -0
- data/models/reason_for_eviction.rb +18 -0
- data/models/reason_for_exclusion.rb +18 -0
- data/models/reference.rb +20 -0
- data/models/relationship_type.rb +19 -0
- data/models/reminder.rb +19 -0
- data/models/residence.rb +25 -0
- data/models/smoking_status_category.rb +18 -0
- data/models/sort_by_option.rb +18 -0
- data/models/time_of_day.rb +18 -0
- data/models/title.rb +17 -0
- data/models/user.rb +20 -0
- data/models/vehicle.rb +21 -0
- data/modules/requests_unsupported.rb +21 -0
- data/modules/unrequestable.rb +23 -0
- data/test/fixtures/ethnicities/find_all.json +38 -0
- data/test/fixtures/members/find.json +31 -0
- data/test/fixtures/titles/find_all_by_filters.json +11 -0
- data/test/integration/find_all_by_filters_test.rb +12 -0
- data/test/integration/find_all_test.rb +11 -0
- data/test/integration/find_test.rb +10 -0
- data/test/lib/authenticator_test.rb +75 -0
- data/test/lib/requests/filter_test.rb +14 -0
- data/test/lib/requests/find_all_by_filter_test.rb +44 -0
- data/test/lib/requests/find_all_test.rb +59 -0
- data/test/lib/requests/find_by_id_test.rb +30 -0
- data/test/lib/requests/post_test.rb +38 -0
- data/test/lib/response_test.rb +46 -0
- data/test/lib/session_test.rb +45 -0
- data/test/models/base_model_test.rb +62 -0
- data/test/test_helper.rb +76 -0
- data/version.rb +1 -1
- metadata +134 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class ReasonForEviction < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:label
|
6
|
+
].freeze
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
9
|
+
|
10
|
+
include Unrequestable
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def attr_name
|
14
|
+
'reasons_for_eviction'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class ReasonForExclusion < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:label
|
6
|
+
].freeze
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
9
|
+
|
10
|
+
include Unrequestable
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def attr_name
|
14
|
+
'reasons_for_exclusion'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/models/reference.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class Reference < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:created,
|
6
|
+
:person,
|
7
|
+
:position,
|
8
|
+
:relationship,
|
9
|
+
:residence
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
attr_accessor *ATTRIBUTES
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def attr_name
|
16
|
+
'references'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class RelationshipType < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:converse,
|
6
|
+
:label
|
7
|
+
].freeze
|
8
|
+
|
9
|
+
attr_accessor *ATTRIBUTES
|
10
|
+
|
11
|
+
include Unrequestable
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def attr_name
|
15
|
+
'relationship_types'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/models/reminder.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class Reminder < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:applicant,
|
6
|
+
:created,
|
7
|
+
:destination,
|
8
|
+
:sender
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
attr_accessor *ATTRIBUTES
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def attr_name
|
15
|
+
'reminders'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/models/residence.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class Residence < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:address,
|
6
|
+
:city,
|
7
|
+
:country,
|
8
|
+
:candidate,
|
9
|
+
:created,
|
10
|
+
:reason_for_leaving,
|
11
|
+
:references,
|
12
|
+
:start_date,
|
13
|
+
:state,
|
14
|
+
:unit_label
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
attr_accessor *ATTRIBUTES
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def attr_name
|
21
|
+
'residences'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class SmokingStatusCategory < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:label
|
6
|
+
].freeze
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
9
|
+
|
10
|
+
include Unrequestable
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def attr_name
|
14
|
+
'smoking_status_categories'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/models/title.rb
ADDED
data/models/user.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class User < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:account,
|
6
|
+
:created,
|
7
|
+
:removed,
|
8
|
+
:member,
|
9
|
+
:role
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
attr_accessor *ATTRIBUTES
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def attr_name
|
16
|
+
'users'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/models/vehicle.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
class Vehicle < BaseModel
|
3
|
+
ATTRIBUTES = [
|
4
|
+
:id,
|
5
|
+
:created,
|
6
|
+
:license_plate,
|
7
|
+
:make,
|
8
|
+
:model,
|
9
|
+
:owner,
|
10
|
+
:year
|
11
|
+
].freeze
|
12
|
+
|
13
|
+
attr_accessor *ATTRIBUTES
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def attr_name
|
17
|
+
'vehicles'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
module Unrequestable
|
3
|
+
class Unsupported < StandardError; end
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def find_all(*)
|
11
|
+
raise Unsupported, "this model may not use the #{__method__} method."
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(*)
|
15
|
+
raise Unsupported, "this model may not use the #{__method__} method."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private_constant :Unsupported
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module HonestRenter
|
2
|
+
module Unrequestable
|
3
|
+
class Unsupported < StandardError; end
|
4
|
+
|
5
|
+
def included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
class << self
|
11
|
+
def find_all(*)
|
12
|
+
raise Unsupported, "this model may not use the #{__method__} method."
|
13
|
+
end
|
14
|
+
|
15
|
+
def find(*)
|
16
|
+
raise Unsupported, "this model may not use the #{__method__} method."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private_constant :Unsupported
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"data": [
|
3
|
+
{
|
4
|
+
"id": 1,
|
5
|
+
"label": "White"
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"id": 2,
|
9
|
+
"label": "Black"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"id": 3,
|
13
|
+
"label": "Hispanic, Lantino, or Spanish origin"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": 4,
|
17
|
+
"label": "Asian"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"id": 5,
|
21
|
+
"label": "Aboriginal"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"id": 6,
|
25
|
+
"label": "Arab"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": 7,
|
29
|
+
"label": "Pacific Islander"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"id": 8,
|
33
|
+
"label": "Other"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"limit": 100,
|
37
|
+
"offset": 0
|
38
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"data": {
|
3
|
+
"id": "TYJH7ptuju",
|
4
|
+
"hasPassword": 1,
|
5
|
+
"inboxFilters": "TYJH7ptuju",
|
6
|
+
"inviteSettings": "TYJH7ptuju",
|
7
|
+
"sendReportsByEmail": true,
|
8
|
+
"users": [
|
9
|
+
"1LXpyPFjYJ"
|
10
|
+
],
|
11
|
+
"accountsWithAccess": [
|
12
|
+
"qupHjmQzUb"
|
13
|
+
],
|
14
|
+
"birthdate": null,
|
15
|
+
"created": 1454552715,
|
16
|
+
"dateToDeleteIdentifyingInfo": null,
|
17
|
+
"ethnicities": [],
|
18
|
+
"emails": [
|
19
|
+
"ZGU3CSVfwn"
|
20
|
+
],
|
21
|
+
"gender": null,
|
22
|
+
"name": "TYJH7ptuju",
|
23
|
+
"notes": [],
|
24
|
+
"notifications": [],
|
25
|
+
"otherEthnicity": "",
|
26
|
+
"phones": [],
|
27
|
+
"positions": null,
|
28
|
+
"preferredEmail": null,
|
29
|
+
"preferredPhone": null
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class FindAllByFiltersTest < WebMockingTest
|
4
|
+
def test_find_all_titles_by_filters
|
5
|
+
session = test_session
|
6
|
+
filters = [HonestRenter::Filter.new(:id, TEST_TITLES_ID)]
|
7
|
+
titles = HonestRenter::Title.find_all_by_filters(filters, session)
|
8
|
+
assert_equal(Array, titles.class)
|
9
|
+
assert_equal(true,
|
10
|
+
titles.all? { |e| e.class == HonestRenter::Title })
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class FindAllTest < WebMockingTest
|
4
|
+
def test_find_all_ethnicities
|
5
|
+
session = test_session
|
6
|
+
ethnicities = HonestRenter::Ethnicity.find_all(session)
|
7
|
+
assert_equal(Array, ethnicities.class)
|
8
|
+
assert_equal(true,
|
9
|
+
ethnicities.all? { |e| e.class == HonestRenter::Ethnicity })
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class FindTest < WebMockingTest
|
4
|
+
def test_find_member
|
5
|
+
session = test_session
|
6
|
+
member = HonestRenter::Member.find(TEST_MEMBER_ID, session)
|
7
|
+
assert_equal(HonestRenter::Member, member.class)
|
8
|
+
assert_equal(TEST_MEMBER_ID, member.id)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../../lib/authenticator'
|
3
|
+
|
4
|
+
module HonestRenter
|
5
|
+
class AuthenticatorTest < MiniTest::Unit::TestCase
|
6
|
+
def test_from_secret_key_member_id
|
7
|
+
secret_key = 'secret_key'
|
8
|
+
member_id = 1234
|
9
|
+
authenticator = Authenticator.from_secret_key_member_id(secret_key, member_id)
|
10
|
+
|
11
|
+
assert_equal(authenticator.class, SecretKeyMemberIdAuthenticator)
|
12
|
+
assert_equal(authenticator.instance_variable_get(:@secret_key), secret_key)
|
13
|
+
assert_equal(authenticator.instance_variable_get(:@member_id), member_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_from_address_and_password
|
17
|
+
address = 'address'
|
18
|
+
password = 'a password'
|
19
|
+
authenticator = Authenticator.from_address_and_password(address, password)
|
20
|
+
|
21
|
+
assert_equal(authenticator.class, AddressPasswordAuthenticator)
|
22
|
+
assert_equal(authenticator.instance_variable_get(:@address), address)
|
23
|
+
assert_equal(authenticator.instance_variable_get(:@password), password)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_secret_key_build_session
|
27
|
+
secret_key = 'secret_key'
|
28
|
+
member_id = 1234
|
29
|
+
authenticator = Authenticator.from_secret_key_member_id(secret_key, member_id)
|
30
|
+
|
31
|
+
assert_equal(authenticator.session.class, HonestRenter::Session)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_address_and_password_session
|
35
|
+
address = 'address'
|
36
|
+
password = 'a password'
|
37
|
+
authenticator = Authenticator.from_address_and_password(address, password)
|
38
|
+
allow(HonestRenter::Post).to receive_message_chain(:new, :call) do
|
39
|
+
instance_double(HonestRenter::Response, headers: {})
|
40
|
+
end
|
41
|
+
|
42
|
+
assert_equal(authenticator.session.class, HonestRenter::Session)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_secret_key_raw_hash_keys
|
46
|
+
secret_key = 'secret_key'
|
47
|
+
member_id = 1234
|
48
|
+
authenticator = Authenticator.from_secret_key_member_id(secret_key, member_id)
|
49
|
+
hash = authenticator.raw_hash
|
50
|
+
expected_keys = [
|
51
|
+
:apiKey,
|
52
|
+
:authorization,
|
53
|
+
:expires,
|
54
|
+
:person,
|
55
|
+
:renewableUntil
|
56
|
+
]
|
57
|
+
|
58
|
+
assert_equal(authenticator.raw_hash.keys, expected_keys)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_renew!
|
62
|
+
allow(HonestRenter::Post).to receive_message_chain(:new, :call) do
|
63
|
+
instance_double(HonestRenter::Response, headers: {})
|
64
|
+
end
|
65
|
+
|
66
|
+
address = 'address'
|
67
|
+
password = 'a password'
|
68
|
+
authenticator = Authenticator.from_address_and_password(address, password)
|
69
|
+
|
70
|
+
assert_equal(authenticator.instance_variable_get(:@session).nil?, true)
|
71
|
+
authenticator.renew!
|
72
|
+
assert_equal(authenticator.instance_variable_get(:@session).nil?, false)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|