rentlinx 0.0.1a1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56bf022f8acf7102f71aa040e128faca6d8270f3
4
- data.tar.gz: bf0058098da091c7e261adf2eec111c44b49ae1c
3
+ metadata.gz: 62760941602e190d7e71c0a22c7b7c471d3c4e47
4
+ data.tar.gz: 835279ed9de32624308d7b25363edbb57cdbdaf4
5
5
  SHA512:
6
- metadata.gz: d71353c3d0d020714c7ff4143ba98eccfb06955774a90869586a2568649f215c3fbb848ee175c116f3a51f9892f3e4db71c6e635a785f192754e13e2a17e1045
7
- data.tar.gz: 830da5da63f459bb45d9cfe889a24479e3d61aaf387b59d0366078ae970b490fe8a7de069fe82444e80f60bf90bfbcbebfb26759d84710b64e619919825c83e8
6
+ metadata.gz: ef753885a804dd79fcbe08be8e8c71b10b2fef8e10cf2d4852551862fd437ec137c9c0bfb930bf4de804f6cf449af158b3614529f2984076ddaac357c803f2eb
7
+ data.tar.gz: fa4d97045432cca302923b2c4c739b486e5dff802c6fb965d27645315c2116a9f92c2ae2e0b092904894985871114e7f6bab1a8a9172f22c25e50387d17f1dc5
data/README.md CHANGED
@@ -1,10 +1,54 @@
1
- # rentlinx_client: Ruby Client Wrapper for the RentLinx API
1
+ [![Gem Version](https://badge.fury.io/rb/rentlinx.svg)](https://rubygems.org/gems/rentlinx)
2
+ [![Build Status](https://travis-ci.org/appfolio/rentlinx_client.svg?branch=master)](https://travis-ci.org/appfolio/rentlinx_client)
3
+ [![Coverage Status](https://coveralls.io/repos/appfolio/rentlinx_client/badge.svg?branch=master)](https://coveralls.io/r/appfolio/rentlinx_client?branch=master)
2
4
 
5
+ # rentlinx_client
3
6
 
4
- ### Installation
7
+ _rentlinx_client_ is a ruby wrapper for the RentLinx API.
8
+
9
+
10
+ ## Installation
5
11
 
6
12
  gem install rentlinx
7
13
 
14
+ ## Contributing and development
15
+
16
+ Pull requests are welcome for this gem. New features require writing new
17
+ tests. A pull request be considered for merging once:
18
+
19
+ * New features are tested
20
+ * All tests pass on Travis CI
21
+ * The code coverage reported by Coveralls does not decrease without reason
22
+
23
+ ### Testing: Code style
24
+
25
+ Travis CI runs two test suites. The first suite performs a style check with the
26
+ tool rubocop. To run rubocop locally first make sure you have the necessary
27
+ tools:
28
+
29
+ bundle install
30
+
31
+ Then, run rubocop across the project's files:
32
+
33
+ rubocop
34
+
35
+ Not all rubocop's rules are set in stone, so once you are receiving only
36
+ warnings testing rules that may not make sense, please comment on your pull
37
+ request indicating you think the rules should be adjusted with your reasoning.
38
+
39
+ ### Testing: Unit tests
40
+
41
+ The second suite is running minitest. The simplest way to invoke our minitest
42
+ suite is via:
43
+
44
+ rake
45
+
46
+ The default rake task actually maps to `rake test`. Additionally individual
47
+ test files can be executed via:
48
+
49
+ ruby -Ilib:test test/FILENAME.rb
50
+
51
+
8
52
  ## Copyright and license
9
53
 
10
54
  Source released under the Simplified BSD License.
@@ -0,0 +1,36 @@
1
+ require 'httpclient'
2
+ require 'json'
3
+ require 'uri'
4
+ require 'rentlinx/default'
5
+
6
+ module Rentlinx
7
+ # Client is the primary interface that users of this gem will utilize.
8
+ class Client
9
+ def initialize(username, password, api_url_prefix)
10
+ @url_prefix = (api_url_prefix + '/').freeze # Extra slashes are fine
11
+ @api_token ||= authenticate(username, password)
12
+ end
13
+
14
+ def self.health_check(username, password, api_url_prefix)
15
+ new(username, password, api_url_prefix)
16
+ end
17
+
18
+ private
19
+
20
+ def authenticate(username, password)
21
+ data = { username: username, password: password }
22
+ response = request('POST', 'authentication/login', data)
23
+ response['AccessToken'].freeze
24
+ end
25
+
26
+ def request(method, path, data = nil)
27
+ options = { body: data.to_json, header: Rentlinx::Default.headers }
28
+ response = session.request(method, URI.join(@url_prefix, path), options)
29
+ JSON.parse(response.body)
30
+ end
31
+
32
+ def session
33
+ @session ||= HTTPClient.new
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ require 'rentlinx/version'
2
+
3
+ module Rentlinx
4
+ # The Default module provides the default configuration options.
5
+ module Default
6
+ USER_AGENT = "Rentlinx Ruby Client #{Rentlinx::VERSION}".freeze
7
+
8
+ class << self
9
+ def headers
10
+ { 'Content-Type' => 'application/json',
11
+ 'User-Agent' => USER_AGENT }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,4 +1,4 @@
1
1
  # Rentlinx
2
2
  module Rentlinx
3
- VERSION = '0.0.1a1'
3
+ VERSION = '0.0.3'
4
4
  end
data/lib/rentlinx.rb CHANGED
@@ -1 +1,10 @@
1
- require 'rentlinx/version'
1
+ require 'rentlinx/client'
2
+
3
+ # The Rentlinx module provides the means to interact with the Rentlinx API.
4
+ module Rentlinx
5
+ class << self
6
+ def client(*args)
7
+ @client ||= Rentlinx::Client.new(*args)
8
+ end
9
+ end
10
+ end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rentlinx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1a1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httpclient
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.6.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.6.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
13
41
  description:
14
42
  email: bryce.boe@appfolio.com
15
43
  executables: []
@@ -19,6 +47,8 @@ files:
19
47
  - LICENSE.txt
20
48
  - README.md
21
49
  - lib/rentlinx.rb
50
+ - lib/rentlinx/client.rb
51
+ - lib/rentlinx/default.rb
22
52
  - lib/rentlinx/version.rb
23
53
  homepage: https://github.com/appfolio/rentlinx_client
24
54
  licenses:
@@ -35,9 +65,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
35
65
  version: '0'
36
66
  required_rubygems_version: !ruby/object:Gem::Requirement
37
67
  requirements:
38
- - - ">"
68
+ - - ">="
39
69
  - !ruby/object:Gem::Version
40
- version: 1.3.1
70
+ version: '0'
41
71
  requirements: []
42
72
  rubyforge_project:
43
73
  rubygems_version: 2.4.3