zalo-api 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 447c13bb6805ba83d120599a6c6a85fcfb98982d0dde523644ba5320eee0e207
4
+ data.tar.gz: 2abc8369eeb4af44b8aee312a67bcb18935c2be581e24e5c6d785db7184fc448
5
+ SHA512:
6
+ metadata.gz: bcc8c7369f2c79f768f6de1b4af7d5fa4e976e700404b215676829597c645e904aad27c09ded1c35a27de9a96f611b6ac2d18cb535b9db7801e92f3977353129
7
+ data.tar.gz: b4ef69c50fdc86ff36ffe72fc478442d0d0ec65059a91610c2e47e3debccc241a4f88d825002a14a644e367c0eeea01381311ecc553b6658749f05f744357724
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.3
@@ -0,0 +1,74 @@
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, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ 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 huyhung1994@gmail.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 [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in zalo-api-ruby-sdk.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,45 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zalo-api (0.1.0)
5
+ addressable
6
+ faraday
7
+ json (>= 1.8)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ diff-lcs (1.3)
15
+ faraday (0.17.0)
16
+ multipart-post (>= 1.2, < 3)
17
+ json (2.2.0)
18
+ multipart-post (2.1.1)
19
+ public_suffix (4.0.1)
20
+ rake (10.5.0)
21
+ rspec (3.9.0)
22
+ rspec-core (~> 3.9.0)
23
+ rspec-expectations (~> 3.9.0)
24
+ rspec-mocks (~> 3.9.0)
25
+ rspec-core (3.9.0)
26
+ rspec-support (~> 3.9.0)
27
+ rspec-expectations (3.9.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.9.0)
30
+ rspec-mocks (3.9.0)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.9.0)
33
+ rspec-support (3.9.0)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ bundler (~> 1.17)
40
+ rake (~> 10.0)
41
+ rspec (~> 3.0)
42
+ zalo-api!
43
+
44
+ BUNDLED WITH
45
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Huy Hùng
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.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Zalo::Api::Ruby::Sdk
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/zalo/api/ruby/sdk`. 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 'zalo-api-ruby-sdk'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install zalo-api-ruby-sdk
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/hungdh0x5e/zalo-api-ruby-sdk. 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
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Zalo::Api::Ruby::Sdk project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hungdh0x5e/zalo-api-ruby-sdk/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'zalo_api'
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -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
data/lib/zalo_api.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'zalo_api/version'
2
+
3
+ module ZaloAPI
4
+ class Error < StandardError; end
5
+ end
@@ -0,0 +1,67 @@
1
+ require 'faraday'
2
+
3
+ require 'zalo_api/version'
4
+ require 'zalo_api/configuration'
5
+ require 'zalo_api/middleware/request/encode_json'
6
+ require 'zalo_api/middleware/request/url_based_access_token'
7
+ require 'zalo_api/middleware/response/sanitize_response'
8
+ require 'zalo_api/middleware/response/parse_json'
9
+ require 'zalo_api/middleware/response/logger'
10
+
11
+ module ZaloAPI
12
+ class Client
13
+ # @return [Configuration] Config instance
14
+ attr_reader :config
15
+
16
+ def initialize
17
+ raise ArgumentError, 'block not given' unless block_given?
18
+
19
+ @config = ZaloAPI::Configuration.new
20
+ yield config
21
+
22
+ config.retry = !!config.retry # nil -> false
23
+ set_default_logger
24
+ end
25
+
26
+ # Creates a connection if there is none, otherwise returns the existing connection.
27
+ #
28
+ # @return [Faraday::Connection] Faraday connection for the client
29
+ def connection
30
+ @connection ||= build_connection
31
+ return @connection
32
+ end
33
+
34
+ # Called by {#connection} to build a connection. Can be overwritten in a
35
+ # subclass to add additional middleware and make other configuration
36
+ # changes.
37
+ #
38
+ # Uses middleware according to configuration options.
39
+ #
40
+ # Request logger if logger is not nil
41
+ #
42
+ # Retry middleware if retry is true
43
+ def build_connection
44
+ Faraday.new(config.options) do |builder|
45
+ # response
46
+ builder.use ZaloAPI::Middleware::Response::ParseJson
47
+ builder.use ZaloAPI::Middleware::Response::SanitizeResponse
48
+ builder.use ZaloAPI::Middleware::Response::Logger, config.logger if config.logger
49
+
50
+ # request
51
+ builder.use ZaloAPI::Middleware::Request::UrlBasedAccessToken, config.access_token
52
+ builder.use ZaloAPI::Middleware::Request::EncodeJson
53
+ builder.use ZendeskAPI::Middleware::Request::Retry, :logger => config.logger if config.retry
54
+
55
+ builder.adapter(Faraday.default_adapter)
56
+ end
57
+ end
58
+
59
+ def set_default_logger
60
+ if config.logger.nil? || config.logger == true
61
+ require 'logger'
62
+ config.logger = Logger.new($stderr)
63
+ config.logger.level = Logger::WARN
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,10 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module ZaloAPI
5
+ module Config
6
+ OA_API_BASE = 'https://openapi.zaloapp.com'
7
+ OA_API_VERSION = 'v2.0'
8
+ THIRD_PARTY_API_VERSION = 'v2.0'
9
+ end
10
+ end
@@ -0,0 +1,42 @@
1
+ module ZaloAPI
2
+ # Holds the configuration options for the client and connection
3
+ class Configuration
4
+ # @return [String] App id
5
+ attr_accessor :app_id
6
+
7
+ # @return [String] App secret
8
+ attr_accessor :app_secret
9
+
10
+ # @return [Hash] Client configurations (eg ssh config) to pass to Faraday
11
+ attr_accessor :client_options
12
+
13
+ # @return [String] OAuth2 access_token
14
+ attr_accessor :access_token
15
+
16
+ # @return [Logger] Logger to use when logging requests.
17
+ attr_accessor :logger
18
+
19
+ # @return [Boolean] Whether to attempt to retry when rate-limited (http status: 429).
20
+ attr_accessor :retry
21
+
22
+ def initialize
23
+ @client_options = {}
24
+ end
25
+
26
+ # Sets accept and user_agent headers, and url.
27
+ #
28
+ # @return [Hash] Faraday-formatted hash of options.
29
+ def options
30
+ {
31
+ :headers => {
32
+ :accept => 'application/json',
33
+ :accept_encoding => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
34
+ :user_agent => "ZaloAPI Ruby #{ZaloAPI::VERSION}"
35
+ },
36
+ :request => {
37
+ :open_timeout => 10
38
+ }
39
+ }.merge(client_options)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ module ZaloAPI
2
+ module Middleware
3
+ module Request
4
+ class EncodeJson < Faraday::Middleware
5
+ CONTENT_TYPE = 'Content-Type'.freeze
6
+ MIME_TYPE = 'application/json'.freeze
7
+ dependency 'json'
8
+
9
+ def call(env)
10
+ type = env[:request_headers][CONTENT_TYPE].to_s
11
+ type = type.split(';', 2).first if type.index(';')
12
+ type
13
+
14
+ if env[:body] && !(env[:body].respond_to?(:to_str) && env[:body].empty?) && (type.empty? || type == MIME_TYPE)
15
+ env[:body] = JSON.dump(env[:body])
16
+ env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE
17
+ end
18
+
19
+ @app.call(env)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,41 @@
1
+ require "faraday/middleware"
2
+
3
+ module ZaloAPI
4
+ module Middleware
5
+ module Request
6
+ # Faraday middleware to handle HTTP Status 429 (rate limiting) / 503 (maintenance)
7
+ # @private
8
+ class Retry < Faraday::Middleware
9
+ DEFAULT_RETRY_AFTER = 10
10
+ ERROR_CODES = [429, 503]
11
+
12
+ def initialize(app, options = {})
13
+ super(app)
14
+ @logger = options[:logger]
15
+ end
16
+
17
+ def call(env)
18
+ original_env = env.dup
19
+ response = @app.call(env)
20
+
21
+ if ERROR_CODES.include?(response.env[:status])
22
+ seconds_left = (response.env[:response_headers][:retry_after] || DEFAULT_RETRY_AFTER).to_i
23
+ @logger.warn "You have been rate limited. Retrying in #{seconds_left} seconds..." if @logger
24
+
25
+ seconds_left.times do |i|
26
+ sleep 1
27
+ time_left = seconds_left - i
28
+ @logger.warn "#{time_left}..." if time_left > 0 && time_left % 5 == 0 && @logger
29
+ end
30
+
31
+ @logger.warn "" if @logger
32
+
33
+ @app.call(original_env)
34
+ else
35
+ response
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ module ZaloAPI
2
+ module Middleware
3
+ module Request
4
+ class UrlBasedAccessToken < Faraday::Middleware
5
+ def initialize(app, token)
6
+ super(app)
7
+ @token = token
8
+ end
9
+
10
+ def call(env)
11
+ if env[:url].query
12
+ env[:url].query += '&'
13
+ else
14
+ env[:url].query = ''
15
+ end
16
+
17
+ env[:url].query += "access_token=#{@token}"
18
+
19
+ @app.call(env)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,43 @@
1
+ module ZaloAPI
2
+ module Middleware
3
+ module Response
4
+ # Faraday middleware to handle logging
5
+ class Logger < Faraday::Middleware
6
+ LOG_LENGTH = 1000
7
+
8
+ def initialize(app, logger = nil)
9
+ super(app)
10
+
11
+ @logger = logger || begin
12
+ require 'logger'
13
+ ::Logger.new(STDOUT)
14
+ end
15
+ end
16
+
17
+ def call(env)
18
+ @logger.info "#{env[:method]} #{env[:url].to_s}"
19
+ @logger.debug dump_debug(env, :request_headers)
20
+
21
+ @app.call(env).on_complete do |env|
22
+ info = "Status #{env[:status]}"
23
+ info.concat(" #{env[:body].to_s[0, LOG_LENGTH]}") if (400..499).cover?(env[:status].to_i)
24
+
25
+ @logger.info info
26
+ @logger.debug dump_debug(env, :response_headers)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def dump_debug(env, headers_key)
33
+ info = env[headers_key].map { |k, v| " #{k}: #{v.inspect}" }.join("\n")
34
+ unless env[:body].nil?
35
+ info.concat("\n")
36
+ info.concat(env[:body].inspect)
37
+ end
38
+ info
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZaloAPI
4
+ module Middleware
5
+ module Response
6
+ class ParseJson < Faraday::Response::Middleware
7
+ CONTENT_TYPE = 'Content-Type'
8
+ VALUES = ['application/json', 'text/json']
9
+ dependency 'json'
10
+
11
+ def on_complete(env)
12
+ type = env[:response_headers][CONTENT_TYPE].to_s
13
+ type = type.split(';', 2).first if type.index(';')
14
+
15
+ return unless VALUES.include?(type)
16
+
17
+ unless env[:body].strip.empty?
18
+ env[:body] = JSON.parse(env[:body], symbolize_names: true)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ module ZaloAPI
2
+ module Middleware
3
+ module Response
4
+ class SanitizeResponse < Faraday::Response::Middleware
5
+ def on_complete(env)
6
+ env[:body].scrub!('')
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ require 'zalo_api/resource'
2
+
3
+ module ZaloAPI
4
+ # API for Offical Account
5
+ class OA < Resource
6
+ # Get Offical Account profile
7
+ def me
8
+ @client.connection.get "#{base_url}/oa/getoa"
9
+ end
10
+
11
+ # Get a list of followers
12
+ # @param [Integer] offset Start position in the list of people followers
13
+ # @param [Integer] count Number of follower people want to take
14
+ # @return [Hash] List user_id
15
+ # {
16
+ # "error": int,
17
+ # "message": String,
18
+ # "data": {
19
+ # "total": int,
20
+ # "followers": [
21
+ # {
22
+ # "user_id": String
23
+ # },...
24
+ # ]
25
+ # }
26
+ # }
27
+ def followers(offset: 0, count: 5)
28
+ @client.connection.get "#{base_url}/oa/getfollowers", { data: { offset: offset, count: count }.to_json }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ require 'zalo_api/config'
2
+
3
+ module ZaloAPI
4
+ class Resource
5
+ attr_reader :attributes
6
+
7
+ # Create a new resource instance.
8
+ # @param [Client] client The client to use
9
+ # @param [Hash] attributes The optional attributes that describe the resource
10
+ def initialize(client, attributes = {})
11
+ raise "Expected a Hash for attributes, got #{attributes.inspect}" unless attributes.is_a?(Hash)
12
+
13
+ @client = client
14
+ @attributes = attributes
15
+ end
16
+
17
+ def base_url
18
+ @base_url ||= "%s/%s" % [ZaloAPI::Config::OA_API_BASE, ZaloAPI::Config::OA_API_VERSION]
19
+ return @base_url
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ module ZaloAPI
2
+ VERSION = "0.1.0"
3
+ end
4
+
data/zalo-api.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'zalo_api/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'zalo-api'
7
+ spec.version = ZaloAPI::VERSION
8
+ spec.authors = ['Huy Hùng']
9
+ spec.email = ["huyhung1994@gmail.com"]
10
+ spec.homepage = 'https://github.com/hungdh0x5e/zalo-api-ruby-sdk'
11
+ spec.license = 'MIT'
12
+
13
+ spec.summary = 'Zalo API Library for Ruby'
14
+ spec.description = 'Ruby wrapper for the REST API at https://zalo.me. Documentation at https://developers.zalo.me/'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_runtime_dependency('faraday')
26
+ spec.add_runtime_dependency('addressable')
27
+ spec.add_runtime_dependency('json', '>= 1.8')
28
+
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
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zalo-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Huy Hùng
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: addressable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.17'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.17'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
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
+ description: Ruby wrapper for the REST API at https://zalo.me. Documentation at https://developers.zalo.me/
98
+ email:
99
+ - huyhung1994@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - bin/console
114
+ - bin/setup
115
+ - lib/zalo_api.rb
116
+ - lib/zalo_api/client.rb
117
+ - lib/zalo_api/config.rb
118
+ - lib/zalo_api/configuration.rb
119
+ - lib/zalo_api/middleware/request/encode_json.rb
120
+ - lib/zalo_api/middleware/request/retry.rb
121
+ - lib/zalo_api/middleware/request/url_based_access_token.rb
122
+ - lib/zalo_api/middleware/response/logger.rb
123
+ - lib/zalo_api/middleware/response/parse_json.rb
124
+ - lib/zalo_api/middleware/response/sanitize_response.rb
125
+ - lib/zalo_api/oa.rb
126
+ - lib/zalo_api/resource.rb
127
+ - lib/zalo_api/version.rb
128
+ - zalo-api.gemspec
129
+ homepage: https://github.com/hungdh0x5e/zalo-api-ruby-sdk
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.0.6
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Zalo API Library for Ruby
152
+ test_files: []