pheenix 0.1.5

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
+ SHA1:
3
+ metadata.gz: 1c7676ded9f68ee0a8676975860df019a93e501d
4
+ data.tar.gz: 063cb6895aa20142653dcb12b5d411aee7ff3710
5
+ SHA512:
6
+ metadata.gz: 809a043d7fcb8039e8277a3986b3d428ce9f02e1e4cb1772735aed8830f3650b68a5d99dd928731b2fde469db880cb3f91e80f41e3a0e82f4734b0167a8068be
7
+ data.tar.gz: 16534cfe7cea2d2bf54ce453556765cf9e490aaa7f6a46c2b53dce66d6b9026741b6742b4d78e1de381b77fac169882431ab3974131af80e5771ec3c16403fa4
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
File without changes
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 pheenix.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 TODO: Write your name
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,51 @@
1
+ # Pheenix
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/pheenix`. 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 'pheenix'
13
+ gem 'curb'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install pheenix
23
+
24
+ ## Usage
25
+
26
+ pheenix = Pheenix::Client.new({username: "username", api_key: "api_key"})
27
+
28
+ pheenix.list_domains
29
+
30
+ pheenix.reseller_check_domains_availability({ domains: 'pheenix.com' })
31
+
32
+ pheenix.reseller_register_domains({ domains: 'newdomain.com' })
33
+
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ 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).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/seadfeng/pheenix. 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.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the Pheenix project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/seadfeng/pheenix/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pheenix"
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__)
@@ -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/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'pheenix'
@@ -0,0 +1,96 @@
1
+ require "pheenix/version"
2
+ require "curb"
3
+ require "json"
4
+ module Pheenix
5
+ class Client
6
+ attr_accessor :login, :pheenix_host, :curl_cookie, :curl_verbose
7
+
8
+ def initialize(login = {})
9
+ @login = login
10
+ @pheenix_host = "https://api.pheenix.com/"
11
+ @curl_cookie = "/tmp/px_cookie"
12
+ @curl_verbose = false
13
+ pheenix_login
14
+ self
15
+ end
16
+
17
+ def pheenix_login
18
+ curl("#{pheenix_host}login/login=#{login[:username]}&api_key=#{login[:api_key]}")
19
+ end
20
+
21
+ # Return: array
22
+ #
23
+ # Arguments:
24
+ #
25
+ # string - url
26
+ def curl(url)
27
+ curl = Curl::Easy.new(url)
28
+ curl.follow_location = true
29
+ curl.enable_cookies = true
30
+ curl.verbose = curl_verbose
31
+ curl.cookiefile = curl_cookie
32
+ curl.cookiejar = curl_cookie
33
+ #curl.perform
34
+ curl.http_get
35
+ JSON.parse(curl.body_str)
36
+ end
37
+
38
+ # Return: string
39
+ #
40
+ def args(name, args )
41
+ if args.class == Array
42
+ args.each do |item|
43
+ i = 0
44
+ if i == 0
45
+ str = "#{name}[0]=#{item}"
46
+ else
47
+ str = "#{str}&#{name}[#{i}]=#{item}"
48
+ end
49
+ i = i + 1
50
+ end
51
+ else
52
+ str = "#{name}=#{args}"
53
+ end
54
+ end
55
+
56
+ def list_domains(config = {})
57
+ if !config[:all].nil? || config[:domains].nil?
58
+ curl("#{pheenix_host}list_domains")
59
+ else
60
+ str = args("domains",config[:domains])
61
+ end
62
+ curl("#{pheenix_host}list_domains/#{str}")
63
+ end
64
+
65
+ def reseller_check_domains_availability(config = {})
66
+ str = args("domains",config[:domains])
67
+ curl("#{pheenix_host}reseller_check_domains_availability/#{str}")
68
+ end
69
+
70
+ def reseller_register_domains(config = {})
71
+ str = args("domains",config[:domains])
72
+ curl("#{pheenix_host}reseller_register_domains/#{str}")
73
+ end
74
+
75
+ def list_backorders
76
+ curl("#{pheenix_host}list_backorders")
77
+ end
78
+
79
+ def list_won_marketplace
80
+ curl("#{pheenix_host}list_won_marketplace")
81
+ end
82
+
83
+ def list_marketplace
84
+ curl("#{pheenix_host}list_marketplace")
85
+ end
86
+
87
+ def list_lost_marketplace
88
+ curl("#{pheenix_host}list_lost_marketplace")
89
+ end
90
+
91
+ def list_current_marketplace
92
+ curl("#{pheenix_host}list_current_marketplace")
93
+ end
94
+ end
95
+ end
96
+
@@ -0,0 +1,3 @@
1
+ module Pheenix
2
+ VERSION = "0.1.5"
3
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "pheenix/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pheenix"
8
+ spec.version = Pheenix::VERSION
9
+ spec.authors = ["Sead Feng"]
10
+ spec.email = ["seadfeng@gmail.com"]
11
+
12
+ spec.summary = "Pheenix APi"
13
+ spec.description = "pheenix Api gem"
14
+ spec.homepage = "https://github.com/seadfeng/pheenix"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+
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_development_dependency "bundler"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "curb"
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pheenix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Sead Feng
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
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: rake
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: curb
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
+ description: pheenix Api gem
56
+ email:
57
+ - seadfeng@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - init.rb
71
+ - lib/pheenix.rb
72
+ - lib/pheenix/version.rb
73
+ - pheenix.gemspec
74
+ homepage: https://github.com/seadfeng/pheenix
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.6.11
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Pheenix APi
98
+ test_files: []