eship-ruby 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 54d6d193460695dd001df588a5c09e4d6e63fcc8258c4b76cb87addbe0a11e56
4
+ data.tar.gz: 92168544d88559de922412ab3755c4ff0781d37ab8bc4200fae6cc40e145656a
5
+ SHA512:
6
+ metadata.gz: 9cbdd3b6a828b8fa8e4092ad6358422296027c6c502a2fae2bcda4534f7b85bcb02db0ee4aaa5afcf1d58a013324e9092bfbff85213a4bd5d9c95acc43e6087b
7
+ data.tar.gz: b60bcfc05908a936908f13effa2e77dc46bed1973d96cb08d6bc9169fbdb81d94538818b2fb20e2d6a6750ef3e013cbb81610665446fba082972d05d96a7e46d
@@ -0,0 +1,19 @@
1
+ # This is a sample build configuration for Ruby.
2
+ # Check our guides at https://confluence.atlassian.com/x/8r-5Mw for more examples.
3
+ # Only use spaces to indent your .yml configuration.
4
+ # -----
5
+ # You can specify a custom docker image from Docker Hub as your build environment.
6
+ image: ruby:2.5.1
7
+
8
+ pipelines:
9
+ default:
10
+ - step:
11
+ caches:
12
+ - bundler
13
+ script: # Modify the commands below to build your repository.
14
+ - bundle install
15
+ - rspec
16
+
17
+ definitions:
18
+ caches:
19
+ bundler: ./vendor
@@ -0,0 +1,64 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
57
+
58
+ # npm
59
+ node_modules
60
+
61
+ # rspec failure tracking
62
+ .rspec_status
63
+
64
+ .Ds_store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in eship-ruby.gemspec
8
+ gemspec
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ eship-ruby (0.1.0)
5
+ httparty (~> 0.16.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ app_version_tasks (0.2.5)
13
+ git (~> 1.3)
14
+ ast (2.4.0)
15
+ crack (0.4.3)
16
+ safe_yaml (~> 1.0.0)
17
+ diff-lcs (1.3)
18
+ docile (1.3.2)
19
+ git (1.6.0)
20
+ rchardet (~> 1.8)
21
+ hashdiff (1.0.1)
22
+ httparty (0.16.4)
23
+ mime-types (~> 3.0)
24
+ multi_xml (>= 0.5.2)
25
+ jaro_winkler (1.5.4)
26
+ mime-types (3.3.1)
27
+ mime-types-data (~> 3.2015)
28
+ mime-types-data (3.2019.1009)
29
+ multi_xml (0.6.0)
30
+ parallel (1.19.1)
31
+ parser (2.7.1.1)
32
+ ast (~> 2.4.0)
33
+ public_suffix (4.0.4)
34
+ rack (2.2.2)
35
+ rainbow (3.0.0)
36
+ rake (10.5.0)
37
+ rchardet (1.8.0)
38
+ rspec (3.9.0)
39
+ rspec-core (~> 3.9.0)
40
+ rspec-expectations (~> 3.9.0)
41
+ rspec-mocks (~> 3.9.0)
42
+ rspec-core (3.9.1)
43
+ rspec-support (~> 3.9.1)
44
+ rspec-expectations (3.9.1)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.9.0)
47
+ rspec-mocks (3.9.1)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.9.0)
50
+ rspec-support (3.9.2)
51
+ rubocop (0.76.0)
52
+ jaro_winkler (~> 1.5.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 2.6)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 1.7)
58
+ rubocop-airbnb (3.0.2)
59
+ rubocop (~> 0.76.0)
60
+ rubocop-performance (~> 1.5.0)
61
+ rubocop-rails (~> 2.3.2)
62
+ rubocop-rspec (~> 1.30.0)
63
+ rubocop-performance (1.5.2)
64
+ rubocop (>= 0.71.0)
65
+ rubocop-rails (2.3.2)
66
+ rack (>= 1.1)
67
+ rubocop (>= 0.72.0)
68
+ rubocop-rspec (1.30.1)
69
+ rubocop (>= 0.60.0)
70
+ ruby-progressbar (1.10.1)
71
+ safe_yaml (1.0.5)
72
+ simplecov (0.18.5)
73
+ docile (~> 1.1)
74
+ simplecov-html (~> 0.11)
75
+ simplecov-html (0.12.2)
76
+ unicode-display_width (1.6.1)
77
+ webmock (3.8.3)
78
+ addressable (>= 2.3.6)
79
+ crack (>= 0.3.2)
80
+ hashdiff (>= 0.4.0, < 2.0.0)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ app_version_tasks
87
+ bundler (~> 1.17)
88
+ eship-ruby!
89
+ rake (~> 10.0)
90
+ rspec (~> 3.0)
91
+ rubocop-airbnb (~> 3.0)
92
+ rubocop-rspec (~> 1.30)
93
+ simplecov (~> 0.17)
94
+ webmock (~> 3.7)
95
+
96
+ BUNDLED WITH
97
+ 1.17.3
@@ -0,0 +1,37 @@
1
+ # Eship::Ruby
2
+
3
+ Eship-ruby es una gema para interactuar con la API de segmail proporciona a través del servicio de paqueterías Eship. Con esta gema es posible generar una orden en el `dashboard` del servicio y continuar el proceso manualmente sin tener que ingresar los datos del remitente y el destinatario de manera manual.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'eship-ruby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install eship-ruby
20
+
21
+ ## Usage
22
+ During the setup configuration you must add your eship api-key and the base URI.
23
+ ```sh
24
+ Eship.config do |config|
25
+ config.base_uri = 'https://app.myeship.co/API/'
26
+ config.eship_key = 'Randomkey12x'
27
+ end
28
+ ```
29
+ ### making querys
30
+ Eship-ruby expects the payload as described in the eship documentation https://myeship.co/docs/
31
+ ```sh
32
+ response = Eship.post_quotation(payload)
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eship-ruby.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'app_version_tasks'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: :spec
10
+
11
+ spec = Gem::Specification.find_by_name 'app_version_tasks'
12
+ load "#{spec.gem_dir}/lib/tasks/app_version_tasks.rake"
13
+ AppVersionTasks.configure do |config|
14
+ config.application_name = 'Eship-ruby'
15
+ config.version_file_path = File.join('lib', 'eship', 'version.rb')
16
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'eship/ruby'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -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,19 @@
1
+ # This is a sample build configuration for Ruby.
2
+ # Check our guides at https://confluence.atlassian.com/x/8r-5Mw for more examples.
3
+ # Only use spaces to indent your .yml configuration.
4
+ # -----
5
+ # You can specify a custom docker image from Docker Hub as your build environment.
6
+ image: ruby:2.5.1
7
+
8
+ pipelines:
9
+ default:
10
+ - step:
11
+ caches:
12
+ - bundler
13
+ script: # Modify the commands below to build your repository.
14
+ - bundle install
15
+ - rspec
16
+
17
+ definitions:
18
+ caches:
19
+ bundler: ./vendor
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'eship/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'eship-ruby'
9
+ spec.version = Eship::VERSION
10
+ spec.authors = ['Yellowme']
11
+ spec.email = ['hola@yellowme.mx']
12
+
13
+ spec.summary = 'Eship-ruby provides a layer to interact with the Segmail API throug the Eship parcels service'
14
+ spec.description = 'with Eship-ruby you can generate an order in the `dashboard` without the need to enter all the data manually.'
15
+ spec.homepage = 'https://yellowme.mx'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_dependency 'httparty', '~> 0.16.0'
27
+
28
+ spec.add_development_dependency 'app_version_tasks'
29
+ spec.add_development_dependency 'bundler', '~> 1.17'
30
+ spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rspec', '~> 3.0'
32
+ spec.add_development_dependency 'rubocop-airbnb', '~> 3.0'
33
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.30'
34
+ spec.add_development_dependency 'simplecov', '~> 0.17'
35
+ spec.add_development_dependency 'webmock', '~> 3.7'
36
+ end
@@ -0,0 +1 @@
1
+ require: rubocop-rspec
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-airbnb
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eship/version.rb'
4
+ require 'eship/api_client.rb'
5
+ require 'eship/endpoints.rb'
6
+ require 'eship/quotation.rb'
7
+
8
+ module Eship
9
+ def self.config
10
+ yield self
11
+ end
12
+
13
+ def self.version
14
+ @version
15
+ end
16
+
17
+ def self.base_uri
18
+ @base_uri
19
+ end
20
+
21
+ def self.base_uri=(base_uri)
22
+ @base_uri = base_uri
23
+ end
24
+
25
+ def self.eship_key
26
+ @eship_key
27
+ end
28
+
29
+ def self.eship_key=(eship_key)
30
+ @eship_key = eship_key
31
+ end
32
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ require 'httparty'
3
+
4
+ module Eship
5
+ module ApiClient
6
+ def self.default_headers
7
+ {
8
+ "content-type" => 'application/json',
9
+ ImmutableKey.new("api-key") => Eship.eship_key
10
+ }
11
+ end
12
+
13
+ def self.post(path:, body: {}, headers: {})
14
+ path = "#{Eship.base_uri}#{path}"
15
+ headers = headers.merge(ApiClient.default_headers)
16
+ response = HTTParty.post(path, body: body.to_json, headers: headers)
17
+ JSON.parse(response.body)
18
+ end
19
+
20
+ #Monkey patch to avoid headers capitalization https://jatindhankhar.in/blog/custom-http-header-and-ruby-standard-library/
21
+ class ImmutableKey < String
22
+ def capitalize
23
+ self
24
+ end
25
+
26
+ def to_s
27
+ self
28
+ end
29
+
30
+ alias_method :to_str, :to_s
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eship
4
+ module Endpoints
5
+ POST_QUOTATION = 'quotation'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eship
4
+ def self.post_quotation(payload)
5
+ response = ApiClient.post(
6
+ path: Endpoints::POST_QUOTATION,
7
+ body: payload
8
+ )
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eship
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eship-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yellowme
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.16.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.16.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: app_version_tasks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-airbnb
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.30'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.30'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.17'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.17'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.7'
139
+ description: with Eship-ruby you can generate an order in the `dashboard` without
140
+ the need to enter all the data manually.
141
+ email:
142
+ - hola@yellowme.mx
143
+ executables: []
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - " bitbucket-pipelines.yml"
148
+ - ".gitignore"
149
+ - ".rspec"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - README.md
153
+ - Rakefile
154
+ - bin/console
155
+ - bin/setup
156
+ - bitbucket-pipelines.yml
157
+ - eship-ruby.gemspec
158
+ - lib/.rubocop.yml
159
+ - lib/.rubocop_airbnb.yml
160
+ - lib/eship.rb
161
+ - lib/eship/api_client.rb
162
+ - lib/eship/endpoints.rb
163
+ - lib/eship/quotation.rb
164
+ - lib/eship/version.rb
165
+ homepage: https://yellowme.mx
166
+ licenses: []
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubygems_version: 3.0.6
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: Eship-ruby provides a layer to interact with the Segmail API throug the Eship
187
+ parcels service
188
+ test_files: []