Class: OrcaApi::StatisticsFormService

Inherits:
Service
  • Object
show all
Defined in:
lib/orca_api/statistics_form_service.rb

Overview

統計実施処理を扱うクラス

Examples:

service = orca_api.new_statistics_form_service
list_result = service.list mode: :daily

list_result.statistics_processing_list_information
# => 処理一覧

# 取得したい統計情報のパラメータなどを設定する
list_result.statistics_processing_list_information = []

create_result = service.create list_result

create_result.err_processing_information
# => エラー一覧
create_result.data_id_information
# => 大容量APIで取得するデータID

# 作成処理が終わるまで #created で問い合わせる
loop do
  created_result = service.created create_result
  break unless created_result.doing?
  sleep 1
end

# 作成処理が終わったら大容量APIで帳票を取得する
blob_result = orca_api.new_blob_service.get reate_result.data_id_information[0]["Print_Id"]

See Also:

Defined Under Namespace

Classes: CreateResult, CreatedResult, ListResult

Instance Attribute Summary

Attributes inherited from Service

#orca_api

Instance Method Summary collapse

Methods inherited from Service

#initialize, reuse_session

Constructor Details

This class inherits a constructor from OrcaApi::Service

Constructor Details

This class inherits a constructor from OrcaApi::Service

Instance Method Details

#create(list_result) ⇒ CreateResult

Returns 処理実施のレスポンスクラス

Parameters:

Returns:

  • (CreateResult)

    処理実施のレスポンスクラス



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/orca_api/statistics_form_service.rb', line 113

def create(list_result)
  statistics_processing_list_information = extract_statistics_processing_list_information list_result
  CreateResult.new(
    orca_api.call(
      "/orca51/statisticsformv3",
      body: {
        statistics_formv3req: {
          "Request_Number" => "01",
          "Karte_Uid" => list_result.karte_uid,
          "Statistics_Mode" => list_result.statistics_mode,
          "Statistics_Processing_List_Information" => statistics_processing_list_information
        }
      }
    )
  )
end

#created(create_result) ⇒ CreatedResult

Returns 処理確認のレスポンスクラス

Parameters:

Returns:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/orca_api/statistics_form_service.rb', line 132

def created(create_result)
  statistics_processing_list_information = extract_statistics_processing_list_information create_result
  CreatedResult.new(
    orca_api.call(
      "/orca51/statisticsformv3",
      body: {
        statistics_formv3req: {
          "Request_Number" => "02",
          "Karte_Uid" => create_result.karte_uid,
          "Orca_Uid" => create_result.orca_uid,
          "Statistics_Mode" => create_result.statistics_mode,
          "Statistics_Processing_List_Information" => statistics_processing_list_information
        }
      }
    )
  )
end

#list(mode:) ⇒ ListResult

Returns 情報取得のレスポンスクラス

Parameters:

  • mode (Symbol)

    指示区分

    • :daily
    • :monthly

Returns:

  • (ListResult)

    情報取得のレスポンスクラス

Raises:

  • (ArgumentError)


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/orca_api/statistics_form_service.rb', line 94

def list(mode:)
  raise ArgumentError unless MODES.key? mode

  ListResult.new(
    orca_api.call(
      "/orca51/statisticsformv3",
      body: {
        statistics_formv3req: {
          "Request_Number" => "00",
          "Karte_Uid" => orca_api.karte_uid,
          "Statistics_Mode" => MODES[mode]
        }
      }
    )
  )
end