housecanary-ruby 0.1.3 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4f1a64363b63d02beb1ebb879a7fe5bd53aaa6013aacb7364b24c0e1eadfa64
4
- data.tar.gz: 6ec3746d843cff2f20e059f923bbc1e118a182439e75a34f76ea7ada26caf1bd
3
+ metadata.gz: 6e46d182e5b9c65a1f6bb9b79bcf59f4882665a34bc1b46c01ecdbc4763b1ac3
4
+ data.tar.gz: 79c3a6393fa8c80cfbf386a3e109cad7eb6dc4c42cbf415a6b906000cd5a0ac5
5
5
  SHA512:
6
- metadata.gz: 3753a4b82b89080b9ace837b520b13ab21ad3317b6fd2b0d6cd2ad5fb1487d501464bf9557ef3b0dd04849949c40b6ff5929af3038b2e5a0d58823534e74f968
7
- data.tar.gz: 8d22d6fbed0db95470b878a1a49a5c4f65a22138c77b2299c741c16c1c859a3e786254ba45c310a3d8fdc1ba921d8521cfbe4dc299bfb52a589953663632ef0a
6
+ metadata.gz: 23010eade4aa6c697963a5e23246fe7867012d3bf5c62b66514f88eb69ba3218ad03f1c5eab9df5ee895fadbc32855e2ea7793942bd9e492aa247328e77491c2
7
+ data.tar.gz: 3489664c46abe84aa7fa2e815b366d03458f0135e6b83a0928df0eef8d9ec6515e53cb97ad45a6652cc982788fa44ac38862871f32465eb5edd5f794013d7255
@@ -0,0 +1,21 @@
1
+ name: RuboCop
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ rubocop:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7
17
+ - name: Lint Ruby code with RuboCop
18
+ run: |
19
+ gem install bundler
20
+ bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
21
+ bundle exec --gemfile gemfiles/rubocop.gemfile rubocop
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+
11
+ *.gem
data/.irbrc CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'pry'
3
5
  Pry.start
data/.rubocop.yml CHANGED
@@ -1,10 +1,6 @@
1
- Style/AccessModifierIndentation:
2
- EnforcedStyle: indent
3
- SupportedStyles:
4
- - outdent
5
- - indent
1
+ inherit_gem:
2
+ jetrockets-standard: config/gems.yml
6
3
 
7
- Metrics/MethodLength:
8
- Max: 25
9
- Metrics/LineLength:
10
- Max: 120
4
+ AllCops:
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
data/Gemfile CHANGED
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in housecanary-ruby.gemspec
4
6
  gemspec
7
+
8
+ eval_gemfile 'gemfiles/rubocop.gemfile'
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "housecanary"
4
+ require 'bundler/setup'
5
+ require 'housecanary'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "housecanary"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org' do
4
+ gem 'jetrockets-standard', '~> 1.0'
5
+ end
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'housecanary/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = 'housecanary-ruby'
7
- spec.version = Housecanary::VERSION
8
- spec.authors = ['Ilia Kriachkov']
9
- spec.email = ['ilia.kriachkov@jetrockets.ru']
8
+ spec.name = 'housecanary-ruby'
9
+ spec.version = Housecanary::VERSION
10
+ spec.authors = ['Ilia Kriachkov']
11
+ spec.email = ['ilia.kriachkov@jetrockets.ru']
10
12
 
11
- spec.summary = %q(Ruby wrapper for the HouseCanary Data & Analytics API.)
12
- spec.description = %q(Ruby wrapper for the HouseCanary Data & Analytics API. https://www.housecanary.com/real-estate-data-api)
13
- spec.homepage = %q(https://github.com/jetrockets/housecanary-ruby)
14
- spec.license = 'MIT'
13
+ spec.summary = 'Ruby wrapper for the HouseCanary Data & Analytics API.'
14
+ spec.description = 'Ruby wrapper for the HouseCanary Data & Analytics API. https://www.housecanary.com/real-estate-data-api'
15
+ spec.homepage = 'https://github.com/jetrockets/housecanary-ruby'
16
+ spec.license = 'MIT'
15
17
 
16
- spec.bindir = 'bin'
17
- spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'bin'
19
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
21
  spec.require_paths = ['lib']
20
- spec.required_ruby_version = '>= 2.3'
22
+ spec.required_ruby_version = '>= 2.7'
21
23
 
22
24
  # a b c d e f g h i j k l m n o p q r s t u v w x y z
23
25
  spec.add_dependency 'dry-auto_inject'
@@ -12,8 +12,8 @@ module Housecanary
12
12
  SALES_HISTORY_PATH = 'property/sales_history'
13
13
 
14
14
  def sales_history(params = {})
15
- if response = perform_response(:get, SALES_HISTORY_PATH, params)
16
- SalesHistory.new(response&.first&.fetch("property/sales_history".to_sym, nil))
15
+ if (response = perform_response(:get, SALES_HISTORY_PATH, params))
16
+ SalesHistory.new(**response&.first&.fetch(:'property/sales_history', nil))
17
17
  end
18
18
  end
19
19
 
@@ -24,8 +24,8 @@ module Housecanary
24
24
  option :record_page, optional: true
25
25
 
26
26
  def self.call(*args)
27
- self.new(*args)
27
+ new(*args)
28
28
  end
29
29
  end
30
30
  end
31
- end
31
+ end
@@ -4,7 +4,7 @@ require 'dry-initializer'
4
4
  require 'http'
5
5
 
6
6
  module Housecanary
7
- class Connection #:nodoc:
7
+ class Connection # :nodoc:
8
8
  extend Dry::Initializer
9
9
  BASE_URL = 'https://api.housecanary.com/v2/'
10
10
 
@@ -19,7 +19,7 @@ module Housecanary
19
19
  ctx = OpenSSL::SSL::SSLContext.new
20
20
  ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
21
21
 
22
- HTTP.basic_auth(user: api_key, pass: api_secret).get(url(path), { ssl_context: ctx }.merge(params))
22
+ HTTP.basic_auth(user: api_key, pass: api_secret).get(url(path), {ssl_context: ctx}.merge(params))
23
23
  end
24
24
 
25
25
  private
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Housecanary
4
- class Error < StandardError #:nodoc:
4
+ class Error < StandardError # :nodoc:
5
5
  attr_reader :code
6
6
 
7
7
  NoContent = Class.new(self)
@@ -4,7 +4,7 @@ require 'housecanary/error'
4
4
  require 'housecanary/utils'
5
5
 
6
6
  module Housecanary
7
- class ResponseParser #:nodoc:
7
+ class ResponseParser # :nodoc:
8
8
  class << self
9
9
  def perform(response)
10
10
  response_body = parse_body(response)
@@ -1,9 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Housecanary
4
- module Utils #:nodoc:
4
+ module Utils # :nodoc:
5
5
  def deep_symbolize_keys(hash)
6
- deep_transform_keys(hash) { |key| key.to_sym rescue key }
6
+ deep_transform_keys(hash) { |key|
7
+ begin
8
+ key.to_sym
9
+ rescue
10
+ key
11
+ end
12
+ }
7
13
  end
8
14
  module_function :deep_symbolize_keys
9
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Housecanary
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.1'
5
5
  end
data/lib/housecanary.rb CHANGED
@@ -8,7 +8,7 @@ require 'housecanary/version'
8
8
  require 'housecanary/connection'
9
9
  require 'housecanary/response_parser'
10
10
 
11
- module Housecanary #:nodoc:
11
+ module Housecanary # :nodoc:
12
12
  @container = ::Dry::Container.new
13
13
  AutoInject = ::Dry::AutoInject(@container)
14
14
 
@@ -33,7 +33,7 @@ module Housecanary #:nodoc:
33
33
  end
34
34
 
35
35
  def register!
36
- connection = ::Housecanary::Connection.new(configuration.to_h)
36
+ connection = ::Housecanary::Connection.new(**configuration.to_h)
37
37
  parser_class = ::Housecanary::ResponseParser
38
38
  container.register :connection, -> { connection }
39
39
  container.register :response_parser, -> { parser_class }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: housecanary-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilia Kriachkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-auto_inject
@@ -173,6 +173,7 @@ executables:
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
+ - ".github/workflows/rubocop.yml"
176
177
  - ".gitignore"
177
178
  - ".irbrc"
178
179
  - ".rspec"
@@ -185,6 +186,7 @@ files:
185
186
  - Rakefile
186
187
  - bin/console
187
188
  - bin/setup
189
+ - gemfiles/rubocop.gemfile
188
190
  - housecanary-ruby.gemspec
189
191
  - lib/housecanary.rb
190
192
  - lib/housecanary/api/helpers.rb
@@ -208,7 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
210
  requirements:
209
211
  - - ">="
210
212
  - !ruby/object:Gem::Version
211
- version: '2.3'
213
+ version: '2.7'
212
214
  required_rubygems_version: !ruby/object:Gem::Requirement
213
215
  requirements:
214
216
  - - ">="