-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for status_list and get_version requests
- Loading branch information
Showing
14 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/vendor/bundle | ||
/coverage | ||
.coveralls.yml | ||
/*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require_relative 'request' | ||
|
||
class AxiomusApi::StatusListRequest < AxiomusApi::Request | ||
class Okey < ::AxiomusApi::Base | ||
xml_field :value, xml_type: :text | ||
end | ||
|
||
class Okeylist < ::AxiomusApi::Base | ||
xml_field_array :okey, type: Okey | ||
|
||
def add_okey(okey) | ||
n_okey = Okey.new | ||
n_okey.value = okey | ||
(@okey ||= []) << n_okey | ||
end | ||
end | ||
|
||
xml_field :okeylist | ||
|
||
def initialize | ||
@okeylist = Okeylist.new | ||
end | ||
|
||
def okeys=(value) | ||
okeys = value.is_a?(Array) ? value : [value] | ||
okeys.each do |o| | ||
@okeylist.add_okey(o.to_s) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'nokogiri' | ||
|
||
class AxiomusApi::StatusListResponse | ||
class Okey | ||
attr_accessor :id | ||
attr_accessor :status_code | ||
attr_accessor :status_name | ||
attr_accessor :inner_id | ||
attr_accessor :price | ||
attr_accessor :customer_price | ||
attr_accessor :value | ||
|
||
def initialize(xml_node) | ||
@id = xml_node.xpath('@id').text | ||
@status_code = xml_node.xpath('@status_code').text | ||
@status_name = xml_node.xpath('@status_name').text | ||
@inner_id = xml_node.xpath('@inner_id').text | ||
@price = xml_node.xpath('@price').text.to_f | ||
@customer_price = xml_node.xpath('@customer_price').text.to_f | ||
@value = xml_node.text | ||
end | ||
end | ||
|
||
attr_accessor :okeys | ||
|
||
def initialize(xml) | ||
doc = Nokogiri::XML(xml) | ||
@okeys = doc.xpath('/response/okeylist/okey').map do |node| | ||
Okey.new(node) | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'nokogiri' | ||
|
||
class AxiomusApi::VersionResponse | ||
attr_accessor :version | ||
|
||
def initialize(xml) | ||
doc = Nokogiri::XML(xml) | ||
@version = doc.xpath('/response/version').text | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module AxiomusApi | ||
VERSION = '0.2' | ||
VERSION = '0.3' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters