vncpost_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.byebug_history +1 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +73 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +17 -0
- data/bin/setup +17 -0
- data/lib/dev/config.rb +7 -0
- data/lib/dev/zeitwerk_loader.rb +22 -0
- data/lib/vncpost_api/configuration.rb +19 -0
- data/lib/vncpost_api/connection.rb +29 -0
- data/lib/vncpost_api/resources/base.rb +59 -0
- data/lib/vncpost_api/resources/order.rb +86 -0
- data/lib/vncpost_api/version.rb +3 -0
- data/lib/vncpost_api.rb +11 -0
- data/vncpost_api.gemspec +35 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2bab00738a4e65dfa53e1da95a9f93610686b232da184fb3195afc4aa765f16e
|
4
|
+
data.tar.gz: debdaf9f7580a9b0752c843be16da364f5c3801e2bf33ab0f775bd4bd6ab5de6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c8d8c3928889f31de818758a1c66e308f8cddf68075bb7f572aafb796eaba8bc060ec2b1cda661182ffafd0ad0bb5284b83ad3015eef5724a4402714aff9824
|
7
|
+
data.tar.gz: 24ac04b1fe4e881359fd948a206fb9baf139fc0d6fccfbcfd0007b454110fe49940d546ffd6c286986be64671a9d307291ff45d452ae15f5d88bdb60d0735ac0
|
data/.byebug_history
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 andy_gg1996@hotmail.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://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vncpost_api (0.1.0)
|
5
|
+
activeresource
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (6.0.2.2)
|
11
|
+
activesupport (= 6.0.2.2)
|
12
|
+
activemodel-serializers-xml (1.0.2)
|
13
|
+
activemodel (> 5.x)
|
14
|
+
activesupport (> 5.x)
|
15
|
+
builder (~> 3.1)
|
16
|
+
activeresource (5.1.0)
|
17
|
+
activemodel (>= 5.0, < 7)
|
18
|
+
activemodel-serializers-xml (~> 1.0)
|
19
|
+
activesupport (>= 5.0, < 7)
|
20
|
+
activesupport (6.0.2.2)
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
+
i18n (>= 0.7, < 2)
|
23
|
+
minitest (~> 5.1)
|
24
|
+
tzinfo (~> 1.1)
|
25
|
+
zeitwerk (~> 2.2)
|
26
|
+
builder (3.2.4)
|
27
|
+
byebug (11.1.1)
|
28
|
+
coderay (1.1.2)
|
29
|
+
concurrent-ruby (1.1.6)
|
30
|
+
diff-lcs (1.3)
|
31
|
+
dotenv (2.7.5)
|
32
|
+
i18n (1.8.2)
|
33
|
+
concurrent-ruby (~> 1.0)
|
34
|
+
method_source (1.0.0)
|
35
|
+
minitest (5.14.0)
|
36
|
+
pry (0.13.1)
|
37
|
+
coderay (~> 1.1)
|
38
|
+
method_source (~> 1.0)
|
39
|
+
pry-byebug (3.9.0)
|
40
|
+
byebug (~> 11.0)
|
41
|
+
pry (~> 0.13.0)
|
42
|
+
rake (12.3.3)
|
43
|
+
rspec (3.9.0)
|
44
|
+
rspec-core (~> 3.9.0)
|
45
|
+
rspec-expectations (~> 3.9.0)
|
46
|
+
rspec-mocks (~> 3.9.0)
|
47
|
+
rspec-core (3.9.1)
|
48
|
+
rspec-support (~> 3.9.1)
|
49
|
+
rspec-expectations (3.9.1)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.9.0)
|
52
|
+
rspec-mocks (3.9.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.9.0)
|
55
|
+
rspec-support (3.9.2)
|
56
|
+
thread_safe (0.3.6)
|
57
|
+
tzinfo (1.2.7)
|
58
|
+
thread_safe (~> 0.1)
|
59
|
+
zeitwerk (2.3.0)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
dotenv
|
66
|
+
pry
|
67
|
+
pry-byebug
|
68
|
+
rake (~> 12.0)
|
69
|
+
rspec (~> 3.0)
|
70
|
+
vncpost_api!
|
71
|
+
|
72
|
+
BUNDLED WITH
|
73
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Andy Chong
|
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
|
+
# VNCPostAPI
|
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/vncpost_api`. 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 'vncpost_api'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install vncpost_api
|
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/PostCo/vncpost_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/PostCo/vncpost_api/blob/master/CODE_OF_CONDUCT.md).
|
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 VNCPostAPI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/PostCo/vncpost_api/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dotenv/load"
|
5
|
+
require "dev/zeitwerk_loader"
|
6
|
+
require "dev/config"
|
7
|
+
require "vncpost_api"
|
8
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
9
|
+
# with your gem easier. You can also use a different console, if you like.
|
10
|
+
set_config
|
11
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
12
|
+
require "pry"
|
13
|
+
require "pry-byebug"
|
14
|
+
Pry.start
|
15
|
+
|
16
|
+
# require "irb"
|
17
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
9
|
+
filename=".env"
|
10
|
+
if [ ! -f $filename ]
|
11
|
+
then
|
12
|
+
touch $filename
|
13
|
+
echo "VNCPOST_API_HOST=http://tu.api.vncpost.com" >> $filename
|
14
|
+
echo "VNCPOST_USERNAME=postco" >> $filename
|
15
|
+
echo "VNCPOST_PASSWORD=" >> $filename
|
16
|
+
echo "VNCPostAPI_GEM_ENV=development" >> $filename
|
17
|
+
fi
|
data/lib/dev/config.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "zeitwerk"
|
2
|
+
require_relative "config"
|
3
|
+
|
4
|
+
loader = Zeitwerk::Loader.for_gem
|
5
|
+
loader.inflector.inflect(
|
6
|
+
"vncpost_api" => "VNCPostAPI"
|
7
|
+
)
|
8
|
+
loader.push_dir("./lib")
|
9
|
+
loader.collapse("./lib/vncpost_api/resources")
|
10
|
+
loader.ignore("#{__dir__}/config.rb")
|
11
|
+
loader.ignore("./lib/vncpost_api/exceptions.rb")
|
12
|
+
loader.enable_reloading
|
13
|
+
# loader.log!
|
14
|
+
loader.setup
|
15
|
+
|
16
|
+
$__vncpost_api_loader__ = loader
|
17
|
+
|
18
|
+
def reload!
|
19
|
+
$__vncpost_api_loader__.reload
|
20
|
+
set_config
|
21
|
+
true
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module VNCPostAPI
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :api_host, :username, :password
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.config
|
7
|
+
@config ||= Configuration.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.config=(config)
|
11
|
+
@config = config
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.configure
|
15
|
+
yield config
|
16
|
+
# set the site once user configure
|
17
|
+
VNCPostAPI::Base.site = VNCPostAPI.config.api_host
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module VNCPostAPI
|
2
|
+
class ResourceInvalid < ActiveResource::ClientError
|
3
|
+
def to_s
|
4
|
+
body = JSON.parse(response.body)
|
5
|
+
if body["Message"]
|
6
|
+
message = "Failed.".dup
|
7
|
+
message << " Error message: #{body["Message"]}"
|
8
|
+
message
|
9
|
+
else
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
class Connection < ActiveResource::Connection
|
15
|
+
private
|
16
|
+
|
17
|
+
def request_failed?(response)
|
18
|
+
body = JSON.parse(response.body)
|
19
|
+
body["Result"] == 2
|
20
|
+
rescue JSON::ParserError
|
21
|
+
false
|
22
|
+
end
|
23
|
+
|
24
|
+
def handle_response(response)
|
25
|
+
raise(ResourceInvalid.new(response)) if request_failed?(response)
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module VNCPostAPI
|
2
|
+
class Base < ::ActiveResource::Base
|
3
|
+
self.include_root_in_json = false
|
4
|
+
self.include_format_in_path = false
|
5
|
+
self.connection_class = VNCPostAPI::Connection
|
6
|
+
self.site = VNCPostAPI.config&.api_host
|
7
|
+
|
8
|
+
def create
|
9
|
+
self.class.retrieve_token
|
10
|
+
format_before_send_request
|
11
|
+
super
|
12
|
+
rescue => e
|
13
|
+
reset_attributes_format
|
14
|
+
raise e
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
raise NotImplementedError, "#update is not supported"
|
19
|
+
end
|
20
|
+
|
21
|
+
def build
|
22
|
+
raise NotImplementedError, "#build is not supported"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.retrieve_token
|
28
|
+
clear_auth_token
|
29
|
+
if VNCPostAPI.config&.username && VNCPostAPI.config&.password
|
30
|
+
response = connection.post("/User/Login", {
|
31
|
+
Username: VNCPostAPI.config.username,
|
32
|
+
Password: VNCPostAPI.config.password
|
33
|
+
}.to_json)
|
34
|
+
connection.auth_type = :bearer
|
35
|
+
connection.bearer_token = JSON.parse(response.body)["token"]
|
36
|
+
else
|
37
|
+
raise ArgumentError, "Please set the username and password in the config file under the initializer dir"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.clear_auth_token
|
42
|
+
connection.auth_type = nil
|
43
|
+
connection.bearer_token = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def format_before_send_request
|
47
|
+
@attributes.transform_keys!(&:camelcase)
|
48
|
+
end
|
49
|
+
|
50
|
+
def reset_attributes_format
|
51
|
+
@attributes.transform_keys!(&:underscore)
|
52
|
+
end
|
53
|
+
|
54
|
+
def load_attributes_from_response(response)
|
55
|
+
super
|
56
|
+
reset_attributes_format
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module VNCPostAPI
|
2
|
+
class Order < Base
|
3
|
+
validates :code, :product_name, :collect_amount, :weight, :width, :height, :length,
|
4
|
+
:source_address, :source_city, :source_district, :source_ward, :source_name, :source_phone_number,
|
5
|
+
:dest_city, :dest_district, :dest_ward, :dest_name, :dest_phone_number, :dest_address, presence: true
|
6
|
+
|
7
|
+
validates :journey_type, inclusion: {
|
8
|
+
in: [1, 2, 3],
|
9
|
+
message: "%{value} is not a supported journey type, supported journey types are 1(Delivery), 2(Exchange), 3(Collect)"
|
10
|
+
}
|
11
|
+
validates :service_id, inclusion: {
|
12
|
+
in: [12490, 12491],
|
13
|
+
message: "%{value} is not a supported service id, supported service ids are 12490(Express), 12491(Eco)"
|
14
|
+
}
|
15
|
+
|
16
|
+
DEFAULT_ATTRS = {
|
17
|
+
code: nil,
|
18
|
+
product_name: "Fashion Apparel",
|
19
|
+
collect_amount: 0,
|
20
|
+
journey_type: 1,
|
21
|
+
service_id: 12490,
|
22
|
+
weight: 0,
|
23
|
+
width: 0,
|
24
|
+
height: 0,
|
25
|
+
length: 0,
|
26
|
+
note: nil,
|
27
|
+
source_address: nil,
|
28
|
+
source_city: nil,
|
29
|
+
source_district: nil,
|
30
|
+
source_ward: nil,
|
31
|
+
source_name: nil,
|
32
|
+
source_phone_number: nil,
|
33
|
+
dest_address: nil,
|
34
|
+
dest_city: nil,
|
35
|
+
dest_district: nil,
|
36
|
+
dest_ward: nil,
|
37
|
+
dest_name: nil,
|
38
|
+
dest_phone_number: nil,
|
39
|
+
return_address: nil,
|
40
|
+
return_city: nil,
|
41
|
+
return_district: nil,
|
42
|
+
return_ward: nil,
|
43
|
+
return_name: nil,
|
44
|
+
return_phone_number: nil
|
45
|
+
}
|
46
|
+
|
47
|
+
self.prefix = "/Order/Add"
|
48
|
+
self.element_name = ""
|
49
|
+
|
50
|
+
def self.track(code)
|
51
|
+
new(code: code).track
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(attributes = {}, persisted = false)
|
55
|
+
attributes = DEFAULT_ATTRS.merge(attributes)
|
56
|
+
super
|
57
|
+
end
|
58
|
+
|
59
|
+
def track
|
60
|
+
puts "#track only available in production environment"
|
61
|
+
self.class.retrieve_token
|
62
|
+
tracking_number = @attributes[:returned_code] || @attributes[:code]
|
63
|
+
get("Track/#{tracking_number}")
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def load_attributes_from_response(response)
|
69
|
+
# save the response attributes
|
70
|
+
if response_code_allows_body?(response.code.to_i) &&
|
71
|
+
(response["Content-Length"].nil? || response["Content-Length"] != "0") &&
|
72
|
+
!response.body.nil? && response.body.strip.size > 0
|
73
|
+
|
74
|
+
attributes = self.class.format.decode(response.body)
|
75
|
+
# Code(client provided code) will be overwrited by response's Code from the server
|
76
|
+
# To avoid that, the code returned will be stored as ReturnedCode
|
77
|
+
attributes["ReturnedCode"] = attributes.delete("Code")
|
78
|
+
|
79
|
+
load(attributes, false, true)
|
80
|
+
# reset the attributes structure after assign attributes that came back from server
|
81
|
+
reset_attributes_format
|
82
|
+
@persisted = true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/vncpost_api.rb
ADDED
data/vncpost_api.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "lib/vncpost_api/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "vncpost_api"
|
5
|
+
spec.version = VNCPostAPI::VERSION
|
6
|
+
spec.authors = ["Andy Chong"]
|
7
|
+
spec.email = ["andygg1996personal@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Ruby object based VNCPost API wrapper."
|
10
|
+
spec.homepage = "https://github.com/PostCo/vncpost_api"
|
11
|
+
spec.license = "MIT"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/PostCo/vncpost_api"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/PostCo/vncpost_api/releases"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "activeresource"
|
30
|
+
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.2"
|
32
|
+
spec.add_development_dependency "dotenv"
|
33
|
+
spec.add_development_dependency "pry-byebug"
|
34
|
+
spec.add_development_dependency "pry"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vncpost_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andy Chong
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activeresource
|
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: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dotenv
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- andygg1996personal@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".byebug_history"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- lib/dev/config.rb
|
103
|
+
- lib/dev/zeitwerk_loader.rb
|
104
|
+
- lib/vncpost_api.rb
|
105
|
+
- lib/vncpost_api/configuration.rb
|
106
|
+
- lib/vncpost_api/connection.rb
|
107
|
+
- lib/vncpost_api/resources/base.rb
|
108
|
+
- lib/vncpost_api/resources/order.rb
|
109
|
+
- lib/vncpost_api/version.rb
|
110
|
+
- vncpost_api.gemspec
|
111
|
+
homepage: https://github.com/PostCo/vncpost_api
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata:
|
115
|
+
allowed_push_host: https://rubygems.org/
|
116
|
+
homepage_uri: https://github.com/PostCo/vncpost_api
|
117
|
+
source_code_uri: https://github.com/PostCo/vncpost_api
|
118
|
+
changelog_uri: https://github.com/PostCo/vncpost_api/releases
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 2.3.0
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubygems_version: 3.1.2
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Ruby object based VNCPost API wrapper.
|
138
|
+
test_files: []
|