viglink-rb 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 23deace68c9c004c1e0b6a8d427fe3e328631e938375f8b12180a5d6437ffa56
4
- data.tar.gz: 34e8930ce536216ceb3f452a9c9895010d38b837f09d0ce3401dc4c7f45c1bae
3
+ metadata.gz: faa1fa0045d25bdad8c7c7aa271278b287a28bbdaee998b759cb50c165a2e22f
4
+ data.tar.gz: 903e2c8b0061938b1006633fdea3da851311538eeec7a26e3ff2df77d0fff6ec
5
5
  SHA512:
6
- metadata.gz: b85feb8e73d49008793ee10148d093ebd15ea963f62d672e325d340cad9a1bcc43f0d801ecdfdab3057257d6dcf50d8f203a60e37e3d7a70d0e4064dfec66d29
7
- data.tar.gz: ff9292b5797c05d590511f834c11f71db3bfd473cf33d1bf6f50fedc16fe1b44064e2b6c4349f01ec60f6d1f1102f435cb2aa62caf661ad42c2f1c95ced6e1ed
6
+ metadata.gz: 37cbde678b548c5cda57db2cb8d745511a1bdbddfa180478c8568f77c6f571f10427376e838a5d24c6d1ed10fc043a14dd4f0fa3641e806335b2a458a3937b59
7
+ data.tar.gz: 62e83a7f42b9e340dd6e4fb3e36dba95189dab73cc346386f05a1fe28073806314b11d9b79727d5502cee272dc9e9891cf8c64afbb51fcc459b1a7196b04485d
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Environment (please complete the following information):**
24
+ - OS: [e.g. Ubuntu]
25
+ - Ruby Version [e.g. 2.5]
26
+ - Version [e.g. 22]
27
+
28
+ **Additional context**
29
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dev@lemoney.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- viglink-rb (0.1.0)
4
+ viglink-rb (0.1.1)
5
5
  httparty
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # VigLink Ruby
2
+ [![Gem Version](https://badge.fury.io/rb/viglink-rb.svg)](https://rubygems.org/gems/viglink-rb) [![Build Status](https://travis-ci.com/lemmoney/viglink-rb.svg?token=kGJtMxwzFwua1ty5npNb&branch=master)](https://travis-ci.com/lemmoney/viglink-rb)
2
3
 
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/viglink`. 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
4
+ Wrapper for the VigLink API
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,7 +21,16 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ ```
25
+ require 'viglink'
26
+
27
+ Viglink.configure do |config|
28
+ config.secret_key = ENV['VIGLINK_SECRET_KEY']
29
+ config.api_key = ENV['VIGLINK_API_KEY']
30
+ end
31
+
32
+ Viglink::Merchant.search page: 1
33
+ ```
26
34
 
27
35
  ## Development
28
36
 
@@ -10,29 +10,33 @@ module Viglink
10
10
  class Merchant
11
11
  SEARCH_PATH = '/api/merchant/search'
12
12
 
13
- def self.from_json(merchant = {})
14
- merchant['rates'] = build_from_json(Viglink::Rate, merchant['rates'])
15
- merchant['industryTypes'] = build_from_json(Viglink::IndustryType,
16
- merchant['industryTypes'])
17
- merchant['countries'] = merchant['countries'].split(',').map(&:upcase)
18
-
19
- new json_map.each_with_object({}) { |(k, v), h| h[k] = merchant[v]; }
20
- end
21
-
22
13
  def self.search(params = {})
23
14
  response = HTTPClient.get path: SEARCH_PATH,
24
15
  query: build_search_parameters(params)
25
16
 
26
17
  merchants = response.parsed_response['merchants'].map do |merchant|
18
+ next if merchant.nil?
27
19
  Merchant.from_json(merchant)
28
20
  end
29
21
 
30
- MerchantResults.new total_pages: response.parsed_response['totalPages'], page: response.parsed_response['page'], merchants: merchants
22
+ MerchantResults.new total_pages: response.parsed_response['totalPages'],
23
+ page: response.parsed_response['page'],
24
+ merchants: merchants
25
+ end
26
+
27
+ def self.from_json(merchant = {})
28
+ merchant['rates'] = build_from_json(Viglink::Rate, merchant['rates'])
29
+ merchant['industryTypes'] = build_from_json(Viglink::IndustryType,
30
+ merchant['industryTypes'])
31
+ merchant['countries'] = merchant['countries'].split(',').map(&:upcase)
32
+
33
+ new json_map.each_with_object({}) { |(k, v), h| h[k] = merchant[v]; }
31
34
  end
32
35
 
33
36
  private_instance_methods
34
37
 
35
38
  def self.build_from_json(klass, items)
39
+ return [] unless items.is_a? Array
36
40
  items.map do |industry_type|
37
41
  klass.from_json(industry_type)
38
42
  end
@@ -59,5 +63,8 @@ module Viglink
59
63
  }
60
64
  end
61
65
  end
62
- MerchantResults = Struct.new(:total_pages, :page, :merchants, keyword_init: true)
66
+ MerchantResults = Struct.new :total_pages,
67
+ :page,
68
+ :merchants,
69
+ keyword_init: true
63
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Viglink
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/viglink-rb.gemspec CHANGED
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
20
20
  # to allow pushing to a single host or delete this section to allow
21
21
  # pushing to any host.
22
22
  if spec.respond_to?(:metadata)
23
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
24
-
25
23
  spec.metadata['homepage_uri'] = spec.homepage
26
24
  spec.metadata['source_code_uri'] = spec.homepage
27
25
  spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viglink-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lemoney Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2019-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -171,10 +171,13 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
175
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
174
176
  - ".gitignore"
175
177
  - ".rspec"
176
178
  - ".rubocop.yml"
177
179
  - ".travis.yml"
180
+ - CODE_OF_CONDUCT.md
178
181
  - Gemfile
179
182
  - Gemfile.lock
180
183
  - LICENSE.txt