retsly 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: '08e36638a9ddd4d7808a02cff141edc7074d6581'
4
+ data.tar.gz: 3bc406ef86bd3981433c0957da58e7823c0024fd
5
+ SHA512:
6
+ metadata.gz: dac296076c1be917c30fec33fbbb6652b12cb1d608ca48c65f75997c8b942b694e200fc7d917de522bd9d5f046d4812f50f8454cd9839bd96f71084d0fcb4394
7
+ data.tar.gz: 0423a0011e98c288f659cfddd3972783bc504f0275cdd2239472a9191e57f4dbaab08670e91c872b3aba26b50cfe89b5031311bfdc3ec68cdfd1c87381c67737
@@ -0,0 +1,2 @@
1
+ m�v`-E��&�x
2
+ ��N� ��@��xu.}�`2Հ����G��IS2�Z?#M�D����Kb����
Binary file
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /retsly-0.1.0.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,52 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Include:
4
+ - '**/*.gemspec'
5
+ - '**/*.podspec'
6
+ - '**/*.jbuilder'
7
+ - '**/*.rake'
8
+ - '**/*.opal'
9
+ - '**/config.ru'
10
+ - '**/Gemfile'
11
+ - '**/Rakefile'
12
+ - '**/Capfile'
13
+ - '**/Podfile'
14
+ - '**/Thorfile'
15
+ - '**/Vagrantfile'
16
+ - '**/Berksfile'
17
+ - '**/Cheffile'
18
+ - '**/Vagabondfile'
19
+ Exclude:
20
+ - 'lib/local_resource.rb'
21
+ - 'lib/generated_obfuscator.rb'
22
+ - 'node_modules/**/*'
23
+ - '**/Guardfile'
24
+ - 'db/**/*'
25
+ - 'tmp/**/*'
26
+ - 'vendor/**/*'
27
+ - 'bin/**/*'
28
+ - 'log/**/*'
29
+ - 'lib/tasks/cucumber.rake'
30
+ - 'config/initializers/active_admin_shared_profile_resources.rb'
31
+ - 'config/initializers/active_admin_shared_task_resources.rb'
32
+ Documentation:
33
+ Enabled: false
34
+ Metrics/BlockLength:
35
+ Max: 100
36
+ Metrics/LineLength:
37
+ Max: 120
38
+ AllowURI: true
39
+ URISchemes:
40
+ - http
41
+ - https
42
+ Metrics/MethodLength:
43
+ CountComments: false
44
+ Max: 15
45
+ Style/RaiseArgs:
46
+ Enabled: false
47
+ Style/ClassAndModuleChildren:
48
+ Enabled: false
49
+ Style/FrozenStringLiteralComment:
50
+ Enabled: false
51
+ Style/Alias:
52
+ EnforcedStyle: prefer_alias_method
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at campbell.bc.e@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in retsly.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Brett Campbell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Retsly
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/retsly`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'retsly'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install retsly
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/retsly. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'retsly'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require 'pry'
10
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MRAwDgYDVQQDDAdzZGF2
3
+ aWVzMRYwFAYKCZImiZPyLGQBGRYGbG9mdDQ3MRMwEQYKCZImiZPyLGQBGRYDY29t
4
+ MB4XDTE3MTExNDE2Mjk1NFoXDTE4MTExNDE2Mjk1NFowPzEQMA4GA1UEAwwHc2Rh
5
+ dmllczEWMBQGCgmSJomT8ixkARkWBmxvZnQ0NzETMBEGCgmSJomT8ixkARkWA2Nv
6
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMmnC3pm+VvzYArTzzEJ
7
+ r3FNDkGtv9grWLFGMG+uD1uNtSvyoB2gJvYvYXw0IWBPnGGOlnG3mbJN39uu/Mw5
8
+ wxd8qZo2Jbht3oz/o2P8ymiR6D7CBL26sdQlTLd9vQbe0Ee7h/9iOIziNTnpPf3S
9
+ mjjKxFw65Db6cCF4nA7QN7wa5VjHDkF+y34Tn3QalpRAEcL7e0AcvUSj4zaPZwQc
10
+ NMQ1anPAc1SyFSlyjFOpJO8/DGW7svgw+HE7ht+wUwJU86pmVsacolUILyggAQnz
11
+ J8zOqCYx2gAkuPgZSN6blAgy+MaMq5g7JCQrpGyZ2B56Y4OvEpZo85MU0z6SQH8b
12
+ 6G8CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJz2
13
+ HNGO7UZ6Lb7vfP5OlcUexZU/MB0GA1UdEQQWMBSBEnNkYXZpZXNAbG9mdDQ3LmNv
14
+ bTAdBgNVHRIEFjAUgRJzZGF2aWVzQGxvZnQ0Ny5jb20wDQYJKoZIhvcNAQEFBQAD
15
+ ggEBAFV+1gvsCyfx7a0Rxx4j5lIWp7j3IcBl08M50bUfqvGk0tVQQoqmwL9NvV/j
16
+ gxTc1WWkXwieCpq7syR8s5XYATXKtKxDraMjUvt4I6RCbyPIKA/26eEBllqzQ6ne
17
+ XatCbJMh2gIgkvmzJTjxX8st66KCYNLwzNUNTbjhlKaKZGkKFd314VTYfR7/6kfl
18
+ 6j39ofZdlo2GEwGRtgsjZa4aCqdAXcGJ9SvM2yJslIbXm0/SYhQ2tlJwr5jQ9vGL
19
+ UJ5WQPTBtyrpUNA3NZDQW/W0bEm41+2evyAwvcBkahBAWsfM+vpPFP+EZ6ymugVT
20
+ hGNADh27PqHgBxcLvQ9JSHtcxvE=
21
+ -----END CERTIFICATE-----
@@ -0,0 +1,18 @@
1
+ require 'awrence'
2
+ require 'json'
3
+ require 'model_attribute'
4
+ require 'rash'
5
+
6
+ require 'retsly/version'
7
+ require 'retsly/client'
8
+ require 'retsly/vendor'
9
+ require 'retsly/listing'
10
+ require 'retsly/listing_map'
11
+
12
+ require 'retsly/models/vendor'
13
+ require 'retsly/models/listing'
14
+ require 'retsly/models/listing_map'
15
+
16
+ module Retsly
17
+ # Your code goes here...
18
+ end
@@ -0,0 +1,39 @@
1
+ module Retsly
2
+ # rubocop:disable Style/MethodName
3
+ class Client
4
+ BASE_URI = 'https://rets.io/api/v1/'.freeze
5
+
6
+ attr_accessor :access_token
7
+ attr_accessor :vendor
8
+
9
+ def initialize(access_token:, vendor: nil)
10
+ @access_token = access_token
11
+ @vendor = vendor
12
+ raise 'Acces Token required' unless @access_token
13
+ end
14
+
15
+ def get(page, query_params = nil)
16
+ raise 'A Page is required' unless page
17
+ json = ::JSON.parse(raw(page, query_params))
18
+ response = ::Hashie::Rash.new(json)
19
+ api_failure(response) unless response.success == true
20
+ response.bundle
21
+ end
22
+
23
+ def raw(page, query_params = nil)
24
+ Net::HTTP.get(URI.parse("#{BASE_URI}#{page}?access_token=#{@access_token}#{query_params}"))
25
+ end
26
+
27
+ def Vendor
28
+ Retsly::Vendor.new(client: self)
29
+ end
30
+
31
+ def Listing
32
+ Retsly::Listing.new(client: self)
33
+ end
34
+
35
+ def api_failure(response)
36
+ raise "API Error: #{response.status} :: #{[response.bundle.name, response.bundle.message].join('-')}"
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,66 @@
1
+ module Retsly
2
+ # rubocop:disable Style/MethodName
3
+ class Listing
4
+ attr_accessor :client
5
+ attr_accessor :where_params
6
+ OPERATORS = %i[eq ne gt lt gte lte in].freeze
7
+
8
+ def initialize(client:)
9
+ @client = client
10
+ @where_params = ::Hashie::Rash.new
11
+ raise 'Must Supply Vendor' unless @client.vendor
12
+ end
13
+
14
+ def all
15
+ find_all(path: "#{@client.vendor}/listings")
16
+ end
17
+
18
+ def find(id)
19
+ listing_attributes = @client.get("#{@client.vendor}/listings/#{id}")
20
+ Retsly::Models::Listing.new(
21
+ listing_attributes.merge(client: @client)
22
+ )
23
+ end
24
+
25
+ def Map
26
+ Retsly::Models::ListingMap.new(client: @client)
27
+ end
28
+
29
+ def where(params = {})
30
+ valid_keys?(params.keys)
31
+ valid_operators?(params_operators(params))
32
+ @where_params.merge!(::Hashie::Rash.new(params))
33
+ self
34
+ end
35
+
36
+ def where_query
37
+ @where_params.to_camelback_keys.map do |key, expression|
38
+ "&#{key.gsub(/Id$/, 'ID')}.#{expression.keys.first}=#{expression.values.last}"
39
+ end.join
40
+ end
41
+
42
+ private
43
+
44
+ def find_all(path:)
45
+ @client.get(path, where_query).map do |vendor_attributes|
46
+ Retsly::Models::Listing.new(
47
+ vendor_attributes.merge(client: @client)
48
+ )
49
+ end
50
+ end
51
+
52
+ def params_operators(params)
53
+ params.values.map(&:keys).flatten
54
+ end
55
+
56
+ def valid_operators?(operators)
57
+ raise 'Invalid Operator' if (operators - OPERATORS).any?
58
+ true
59
+ end
60
+
61
+ def valid_keys?(keys)
62
+ raise 'Invalid Field' if (keys - Retsly::Models::Listing.attributes).any?
63
+ true
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,24 @@
1
+ module Retsly
2
+ class ListingMap
3
+ attr_accessor :client
4
+
5
+ def initialize(client:)
6
+ @client = client
7
+ raise 'Must Supply Vendor' unless @client.vendor
8
+ end
9
+
10
+ def all
11
+ find_all(path: "#{@client.vendor}/listings/maps")
12
+ end
13
+
14
+ private
15
+
16
+ def find_all(path:)
17
+ @client.get(path).map do |vendor_attributes|
18
+ Retsly::Models::ListingMap.new(
19
+ vendor_attributes.merge(client: @client)
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,133 @@
1
+ module Retsly
2
+ module Models
3
+ # rubocop:disable Metrics/ClassLength
4
+ class Listing
5
+ extend ::ModelAttribute
6
+ attr_accessor :client
7
+ attribute :id, :string
8
+ attribute :mls_listing_id, :string
9
+ attribute :address, :string
10
+ attribute :unit_number, :string
11
+ attribute :street_name, :string
12
+ attribute :street_number, :string
13
+ attribute :city, :string
14
+ attribute :state, :string
15
+ attribute :county, :string
16
+ attribute :country, :string
17
+ attribute :zip_code, :string
18
+ attribute :subdivision, :string
19
+ attribute :coordinates, :json
20
+ attribute :list_date, :time
21
+ attribute :last_modified, :string
22
+ attribute :price, :json
23
+ attribute :previous_price, :json
24
+ attribute :original_price, :json
25
+ attribute :close_price, :json
26
+ attribute :buyer_financing, :string
27
+ attribute :contingency, :string
28
+ attribute :disclosures, :json
29
+ attribute :units_in_building, :integer
30
+ attribute :cancelation_date, :time
31
+ attribute :expiration_date, :time
32
+ attribute :terms_of_sale, :json
33
+ attribute :date_listed, :string
34
+ attribute :date_sold, :time
35
+ attribute :status_change, :string
36
+ attribute :ownership, :string
37
+ attribute :financial_data_source, :string
38
+ attribute :year_built, :integer
39
+ attribute :year_built_details, :string
40
+ attribute :days_on_market, :integer
41
+ attribute :appliances, :json
42
+ attribute :telephone_service, :json
43
+ attribute :view, :json
44
+ attribute :waterfront, :boolean
45
+ attribute :water_source, :json
46
+ attribute :zoning, :string
47
+ attribute :zoning_description, :string
48
+ attribute :acres, :json
49
+ attribute :square_footage, :integer
50
+ attribute :living_area, :integer
51
+ attribute :above_grade_finished_area, :integer
52
+ attribute :below_grade_finished_area, :integer
53
+ attribute :stories, :integer
54
+ attribute :stories_total, :integer
55
+ attribute :baths, :integer
56
+ attribute :half_baths, :integer
57
+ attribute :bedrooms, :integer
58
+ attribute :rooms_total, :integer
59
+ attribute :fireplaces, :integer
60
+ attribute :fireplace_features, :json
61
+ attribute :exterior_features, :json
62
+ attribute :new_construction, :boolean
63
+ attribute :home_warranty, :boolean
64
+ attribute :architectural_style, :json
65
+ attribute :community_features, :json
66
+ attribute :patio_and_porch_features, :json
67
+ attribute :lot_features, :json
68
+ attribute :basement, :json
69
+ attribute :other_structures, :json
70
+ attribute :pets_allowed, :json
71
+ attribute :flooring, :json
72
+ attribute :foundation_details, :json
73
+ attribute :frontage_length, :integer
74
+ attribute :gas, :json
75
+ attribute :accessibility_features, :json
76
+ attribute :cooling, :json
77
+ attribute :heating, :json
78
+ attribute :parcel_number, :string
79
+ attribute :additional_parcels, :boolean
80
+ attribute :occupant_type, :string
81
+ attribute :pool, :boolean
82
+ attribute :pool_features, :json
83
+ attribute :pool_private, :boolean
84
+ attribute :possession, :json
85
+ attribute :road_surface, :json
86
+ attribute :roof, :json
87
+ attribute :construction_materials, :json
88
+ attribute :sewer, :json
89
+ attribute :garage_spaces, :integer
90
+ attribute :carport_spaces, :integer
91
+ attribute :open_parking, :boolean
92
+ attribute :attached_garage, :boolean
93
+ attribute :carport, :boolean
94
+ attribute :laundry, :json
95
+ attribute :type, :string
96
+ attribute :subtype, :string
97
+ attribute :public_remarks, :string
98
+ attribute :private_remarks, :string
99
+ attribute :media, :json
100
+ attribute :agent, :string
101
+ attribute :mls_agent_id, :string
102
+ attribute :office, :string
103
+ attribute :mls_office_id, :string
104
+ attribute :status, :string
105
+ attribute :contract_status_change_date, :time
106
+ attribute :contingent_date, :time
107
+ attribute :withdrawn_date, :time
108
+ attribute :off_market_date, :time
109
+ attribute :purchase_contract_date, :time
110
+ attribute :original_entry_timestamp, :time
111
+ attribute :tax_assessed_value, :json
112
+ attribute :tax_annual, :json
113
+ attribute :tax_year, :integer
114
+ attribute :tax_status, :json
115
+ attribute :association, :boolean
116
+ attribute :association_name, :string
117
+ attribute :association_fee, :json
118
+ attribute :association_fee_frequency, :string
119
+ attribute :listing_agent_first_name, :string
120
+ attribute :listing_agent_last_name, :string
121
+ attribute :listing_agent_middle_name, :string
122
+ attribute :listing_agent_full_name, :string
123
+ attribute :listing_agent_phone, :string
124
+ attribute :listing_office_name, :string
125
+ attribute :listing_office_phone, :string
126
+ attribute :url, :string
127
+
128
+ def initialize(attributes = {})
129
+ set_attributes(attributes)
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,15 @@
1
+ module Retsly
2
+ module Models
3
+ class ListingMap
4
+ extend ModelAttribute
5
+ attr_accessor :client
6
+ attribute :id, :string
7
+ attribute :coordinates, :json
8
+ attribute :url, :string
9
+
10
+ def initialize(attributes = {})
11
+ set_attributes(attributes)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module Retsly
2
+ module Models
3
+ class Vendor
4
+ extend ::ModelAttribute
5
+ attr_accessor :client
6
+ attribute :vendor_id, :string
7
+ attribute :name, :string
8
+ attribute :logo, :string
9
+ attribute :test, :boolean
10
+ attribute :type, :string
11
+ attribute :update, :string
12
+ attribute :center, :json
13
+ attribute :boundary, :json
14
+ attribute :active_agents, :integer
15
+ attribute :active_listings, :integer
16
+ attribute :active_offices, :integer
17
+
18
+ def initialize(attributes = {})
19
+ set_attributes(attributes)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ module Retsly
2
+ class Vendor
3
+ attr_accessor :client
4
+
5
+ def initialize(client:)
6
+ @client = client
7
+ end
8
+
9
+ def all
10
+ find_all(path: 'vendors')
11
+ end
12
+
13
+ def find(id)
14
+ vendor_attributes = @client.get("vendors/#{id}")
15
+ Retsly::Models::Vendor.new(
16
+ vendor_attributes.merge(client: @client)
17
+ )
18
+ end
19
+
20
+ def approved
21
+ find_all(path: 'vendors/approved')
22
+ end
23
+
24
+ private
25
+
26
+ def find_all(path:)
27
+ @client.get(path).map do |vendor_attributes|
28
+ Retsly::Models::Vendor.new(
29
+ vendor_attributes.merge(client: @client)
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module Retsly
2
+ VERSION = '0.1.1'.freeze
3
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'retsly/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'retsly'
9
+ spec.version = Retsly::VERSION
10
+ spec.authors = ['Loft47']
11
+ spec.email = ['support@loft47.com']
12
+
13
+ spec.summary = %(Retsly Library.)
14
+ spec.description = %(Ruby Library for Retsly API.)
15
+ spec.homepage = 'http://github.com/Loft47/loft'
16
+ spec.license = 'MIT'
17
+ spec.cert_chain = ['certs/shanedavies.pem']
18
+ spec.signing_key = File.expand_path('~/.ssh/retsly-private_key.pem') if $PROGRAM_NAME.end_with?('gem')
19
+ spec.required_ruby_version = '~> 2.0'
20
+
21
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
22
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
23
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
24
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_runtime_dependency 'awrence', '~> 1.0'
32
+ spec.add_runtime_dependency 'model_attribute', '~> 3.1'
33
+ spec.add_runtime_dependency 'rash', '~> 0.4.0'
34
+ spec.add_development_dependency 'simplecov', '~> 0.14'
35
+ spec.add_development_dependency 'coveralls', '~> 0.8.21'
36
+ spec.add_development_dependency 'bundler', '~> 1.16'
37
+ spec.add_development_dependency 'rake', '~> 12.2'
38
+ spec.add_development_dependency 'rspec', '~> 3.7'
39
+ spec.add_development_dependency 'rubocop', '~> 0.51.0'
40
+ spec.add_development_dependency 'pry', '~> 0.11.3'
41
+ spec.add_development_dependency 'webmock', '~> 3.1'
42
+ end
metadata ADDED
@@ -0,0 +1,243 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: retsly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Loft47
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MRAwDgYDVQQDDAdzZGF2
14
+ aWVzMRYwFAYKCZImiZPyLGQBGRYGbG9mdDQ3MRMwEQYKCZImiZPyLGQBGRYDY29t
15
+ MB4XDTE3MTExNDE2Mjk1NFoXDTE4MTExNDE2Mjk1NFowPzEQMA4GA1UEAwwHc2Rh
16
+ dmllczEWMBQGCgmSJomT8ixkARkWBmxvZnQ0NzETMBEGCgmSJomT8ixkARkWA2Nv
17
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMmnC3pm+VvzYArTzzEJ
18
+ r3FNDkGtv9grWLFGMG+uD1uNtSvyoB2gJvYvYXw0IWBPnGGOlnG3mbJN39uu/Mw5
19
+ wxd8qZo2Jbht3oz/o2P8ymiR6D7CBL26sdQlTLd9vQbe0Ee7h/9iOIziNTnpPf3S
20
+ mjjKxFw65Db6cCF4nA7QN7wa5VjHDkF+y34Tn3QalpRAEcL7e0AcvUSj4zaPZwQc
21
+ NMQ1anPAc1SyFSlyjFOpJO8/DGW7svgw+HE7ht+wUwJU86pmVsacolUILyggAQnz
22
+ J8zOqCYx2gAkuPgZSN6blAgy+MaMq5g7JCQrpGyZ2B56Y4OvEpZo85MU0z6SQH8b
23
+ 6G8CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJz2
24
+ HNGO7UZ6Lb7vfP5OlcUexZU/MB0GA1UdEQQWMBSBEnNkYXZpZXNAbG9mdDQ3LmNv
25
+ bTAdBgNVHRIEFjAUgRJzZGF2aWVzQGxvZnQ0Ny5jb20wDQYJKoZIhvcNAQEFBQAD
26
+ ggEBAFV+1gvsCyfx7a0Rxx4j5lIWp7j3IcBl08M50bUfqvGk0tVQQoqmwL9NvV/j
27
+ gxTc1WWkXwieCpq7syR8s5XYATXKtKxDraMjUvt4I6RCbyPIKA/26eEBllqzQ6ne
28
+ XatCbJMh2gIgkvmzJTjxX8st66KCYNLwzNUNTbjhlKaKZGkKFd314VTYfR7/6kfl
29
+ 6j39ofZdlo2GEwGRtgsjZa4aCqdAXcGJ9SvM2yJslIbXm0/SYhQ2tlJwr5jQ9vGL
30
+ UJ5WQPTBtyrpUNA3NZDQW/W0bEm41+2evyAwvcBkahBAWsfM+vpPFP+EZ6ymugVT
31
+ hGNADh27PqHgBxcLvQ9JSHtcxvE=
32
+ -----END CERTIFICATE-----
33
+ date: 2017-11-14 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: awrence
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.0'
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: model_attribute
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.1'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.1'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rash
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.4.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.4.0
77
+ - !ruby/object:Gem::Dependency
78
+ name: simplecov
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.14'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.14'
91
+ - !ruby/object:Gem::Dependency
92
+ name: coveralls
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 0.8.21
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: 0.8.21
105
+ - !ruby/object:Gem::Dependency
106
+ name: bundler
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.16'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.16'
119
+ - !ruby/object:Gem::Dependency
120
+ name: rake
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '12.2'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '12.2'
133
+ - !ruby/object:Gem::Dependency
134
+ name: rspec
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '3.7'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '3.7'
147
+ - !ruby/object:Gem::Dependency
148
+ name: rubocop
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: 0.51.0
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: 0.51.0
161
+ - !ruby/object:Gem::Dependency
162
+ name: pry
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: 0.11.3
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: 0.11.3
175
+ - !ruby/object:Gem::Dependency
176
+ name: webmock
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '3.1'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '3.1'
189
+ description: Ruby Library for Retsly API.
190
+ email:
191
+ - support@loft47.com
192
+ executables: []
193
+ extensions: []
194
+ extra_rdoc_files: []
195
+ files:
196
+ - ".gitignore"
197
+ - ".rspec"
198
+ - ".rubocop.yml"
199
+ - ".travis.yml"
200
+ - CODE_OF_CONDUCT.md
201
+ - Gemfile
202
+ - LICENSE.txt
203
+ - README.md
204
+ - Rakefile
205
+ - bin/console
206
+ - bin/setup
207
+ - certs/shanedavies.pem
208
+ - lib/retsly.rb
209
+ - lib/retsly/client.rb
210
+ - lib/retsly/listing.rb
211
+ - lib/retsly/listing_map.rb
212
+ - lib/retsly/models/listing.rb
213
+ - lib/retsly/models/listing_map.rb
214
+ - lib/retsly/models/vendor.rb
215
+ - lib/retsly/vendor.rb
216
+ - lib/retsly/version.rb
217
+ - retsly.gemspec
218
+ homepage: http://github.com/Loft47/loft
219
+ licenses:
220
+ - MIT
221
+ metadata:
222
+ allowed_push_host: https://rubygems.org
223
+ post_install_message:
224
+ rdoc_options: []
225
+ require_paths:
226
+ - lib
227
+ required_ruby_version: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - "~>"
230
+ - !ruby/object:Gem::Version
231
+ version: '2.0'
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements: []
238
+ rubyforge_project:
239
+ rubygems_version: 2.5.2
240
+ signing_key:
241
+ specification_version: 4
242
+ summary: Retsly Library.
243
+ test_files: []
Binary file